In the onClick handler for the button, you can refer to the 'this'
object, or pass it to a function. 'this' will always refer to the
button that was clicked.

Can't do the same with onSubmit though. Maybe you could set a
javascript variable using the 'this' object on the onClick, and pick
up that variable to use in the onSubmit handler.

bye


Thursday, May 12, 2005, 6:58:24 AM, you wrote:

DM> Say you've got a form with multiple submit btns, each given the name
DM> "form_action", but with different values. When the form is submitted, the
DM> clicked submit btn's value shows up as form.form_action, as expected.

DM> However, from within an onclick handler for any of those btns, or an
DM> onsubmit handler for the form, form.form_action.value is undefined. This
DM> means that validation or other code that needs to know which submit btn was
DM> clicked can't tell.

DM> What I've done in the past is to include a hidden form field whose value is
DM> what we pay attention to, and set its value in the onclick handler for each
DM> submit btn.

DM> Anyone have any other strategies?

DM> Dave Merrill


DM> PECULIAR ASIDE:
DM> Interestingly, to set the value of that hidden field, you use:
DM>         form.form_action.value = "whatever",
DM> ....even though there's a hidden field plus multiple submit btns, all with
DM> that name. Typically you'd need to access that hidden field as:
DM>         form.form_action.value[0]
DM> ....but that generates an error. It's like the named submit btns don't exist
DM> on this level. Odd.



DM> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206491
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to