Fórumok

Nyitólap » Alloy UI » English

Kombinált nézet Egyszerű nézet Fa-nézet
Szálak [ Előző | Következő ]
toggle
Maximiliano Chiesa
Clean all fields button
2012. július 20. 10:43
Válasz

Maximiliano Chiesa

Rangsorolás: Junior Member

Hozzászólások: 43

Csatlakozás dátuma: 2012. július 20.

Legújabb hozzászólások

Hi! I started learning Liferay a couple of days ago, I'm developing a new portlet for a portal and a I have a Form in which I need a "Clear" button that resets all the fields of the form to their default values.
This is my form at the moment, the button "Clean" would call the action to reset the rest of the fields.

<aui:form action="<%= generateValues %>" method="post">

<aui:select name="depts" label="Depts."> ....... </aui:select>

<aui:select name="type" label="Type"> ....... </aui:select>

<aui:input label="pattern" name="padron" type="text"/>
<br/>

<aui:button type="submit" value="View information" />
<aui:button type="cancel" value="Clean" />
<br/>
</aui:form>


What's the best way of making this?

Thanks!
Hitoshi Ozawa
RE: Clean all fields button
2012. július 20. 20:41
Válasz

Hitoshi Ozawa

Rangsorolás: Liferay Legend

Hozzászólások: 8000

Csatlakozás dátuma: 2010. március 23.

Legújabb hozzászólások

Create a javascript to initialize settings and have button call this method onClick().

<aui:button onClick="<%= initForm() %>" type="cancel" value="Clean" />
Joseph Hobbs
RE: Clean all fields button
2012. július 24. 6:23
Válasz

Joseph Hobbs

Rangsorolás: New Member

Hozzászólások: 14

Csatlakozás dátuma: 2012. július 10.

Legújabb hozzászólások

What about just reloading the page? When the form is displayed it would contain whatever settings/values are present at that time. This would avoid the need to have to cache the info, and would also show any updates that another may have performed between the form display and a user clicking cancel/clean.
Maximiliano Chiesa
RE: Clean all fields button
2012. július 24. 6:40
Válasz

Maximiliano Chiesa

Rangsorolás: Junior Member

Hozzászólások: 43

Csatlakozás dátuma: 2012. július 20.

Legújabb hozzászólások

This is how I finnaly solved this:

<aui:button type="cancel" value="Limpiar" onclick="this.form.reset()" />

Not sure if it's the best solution but it worked emoticon

Thanks!
Hitoshi Ozawa
RE: Clean all fields button
2012. július 24. 14:29
Válasz

Hitoshi Ozawa

Rangsorolás: Liferay Legend

Hozzászólások: 8000

Csatlakozás dátuma: 2010. március 23.

Legújabb hozzászólások

Your solution seems to be better than mine. Will use it the next time. :-)
Mazhar Alam
RE: Clean all fields button
2013. január 13. 22:41
Válasz

Mazhar Alam

Rangsorolás: Regular Member

Hozzászólások: 179

Csatlakozás dátuma: 2011. november 25.

Legújabb hozzászólások

Try this,

<aui:button type="reset" value="clear"/>