[
http://jira.jboss.com/jira/browse/JBSEAM-1598?page=comments#action_12368906 ]
Dan Allen commented on JBSEAM-1598:
-----------------------------------
Hmm...well, it will work perfectly for text fields, assuming of course that
"this" is really a form button. If it is a link, then there needs to be some
find logic for the current form. The tricky part is other types of fields. Like should a
checkbox be checked or not checked? What about a select?
Let me try a slightly different idea. If we mirror s:link and s:button, then for this to
work, all we have to do is NOT send any data-related query parameters. The trouble with
s:link and s:button is that they automatically propagate these values. So it isn't
that we want to "clear" the form values, so much as it is that we want to submit
without sending any POST or GET data other than what is needed to correlate it with the
action, conversation, and task.
Basically you take UIButton, which extends UISeamCommandBase, and you override the
getUrl() method to prevent appending the PageParameters and UIParameters. Keep the
conversation, task, and action stuff. What you are saying is, I would like to continue
onwards, but I don't want the data from the form. Of course, you could also argue that
a simple flag on s:link and s:button would accomplish the same thing.
s:clearButton/s:clearLink
-------------------------
Key: JBSEAM-1598
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1598
Project: JBoss Seam
Issue Type: Feature Request
Components: JSF
Affects Versions: 2.0.0.BETA1
Reporter: Dan Allen
Priority: Minor
Original Estimate: 30 minutes
Remaining Estimate: 30 minutes
The search is a very nice feature to have on the list pages generated by seam-gen, but I
have watched people (and struggled myself) with figuring out how to clear the current
filter. It is very annoying to have to manually erase all the values entered in the form
and then submit the form again once cleared. Far easier would be to have a Clear button
on this form.
The following button would do the trick.
<h:commandButton id="clear" value="Clear" onclick="for (var i
= 0, len = this.form.length; i < len; i++) { if (this.form[i].type ==
'text') { this.form[i].value = ''; } }"
action="/${listPageName}.xhtml"/>
I will admit that the JavaScript is a little hacky, but it gets the point across. Feel
free to refine.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira