>Say you've got a form with multiple submit btns, each given the name
>"form_action", but with different values. When the form is submitted, the
>clicked submit btn's value shows up as form.form_action, as expected.
>
>However, from within an onclick handler for any of those btns, or an
>onsubmit handler for the form, form.form_action.value is undefined. This
>means that validation or other code that needs to know which submit btn was
>clicked can't tell.
>
>What I've done in the past is to include a hidden form field whose value is
>what we pay attention to, and set its value in the onclick handler for each
>submit btn.
>
>Anyone have any other strategies?
>
>Dave Merrill

Have you tried changing the action attribute of the form using javascript as in:

<input type="button" value="Search for AA"  class="SearchSubmit" 
onClick="document.searchForm.action='search.cfm?fuseaction=AAResults'">

<input type="button" value="Search for BB"  class="SearchSubmit" 
onClick="document.searchForm.action='search.cfm?fuseaction=BBResults'">

<input type="button" value="Search for CC"  class="SearchSubmit" 
onClick="document.searchForm.action='search.cfm?fuseaction=CCResults'">


larry

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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206530
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