<form jwcid="@Form" listener="listener:updateStaff">
<select jwcid="staffselect@Select" multiple="ognl:false" validators="validators:required" onchange="this.form.submit()" listener="listener:updateStaff">
<span jwcid="@For" source="ognl:hrStaff" value="ognl:currentHrStaff" index="ognl:currentHrStaffIndex">
<option class="text11" jwcid="@Option" selected="ognl:hrStaffSelection[currentHrStaffIndex]" label="ognl:currentHrStaff"/>
</span>
</select>
</form>
开发者_开发问答
when onchange on selectbox, this form will be submitted and my pageValidate() will be called follow by upadteStaff() listener method. I wonder, when such submission is fired, can onchange='' pass a flag ('selectboxisfired' string) that i able to capture inside pagevalidate() 'selectboxisfired'? this will allow my logic inside pagevalidate to indicate is triggered by selectbox.
onchange="window.submitTrigger=this; this.form.submit();"
Then you can read the window.submitTrigger
variable in your validation routines to work out which element triggered the submission, for example
/* somewhere in pagevalidate() routine */
/* note here that I am assuming the html id of the selectbox is "staffselect"
-> I'm not familiar with Tapestry so simply had to make the assumption
that this is the correct id - if not, change the string you're searching
for accordingly */
if (window.submitTrigger.id = "staffselect") {
//do something here
}
Of note, is that I think it's bad style to use onchange in this way, however not understanding Tapestry, I'm just giving you the most simple change to what's already there which I assume will work...
精彩评论