Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Multipile Submit Buttons (Save and Cancel)

$
0
0
Re: Multipile Submit Buttons (Save and Cancel)
Web Connection 5.0
Re: Multipile Submit Buttons (Save and Cancel)
May. 13, 2013
11:17 am
3S80O73CDShow this entire thread in new window
Gratar Image based on email address
From:Roy M
To:Marty Cantwell
Thanks Marty ... this cleared it up for me.

Roy


As Rick points out, you place your code to determine which button was pressed on the server side (in method saverecord in this case). Personally, I like to group all actions associated with a form together this way in the same method code. For me, it makes it much easier to maintain later. If you wish to call a different cancel function from the saverecord method though, that's no problem either.

There may be a better way to do this now (since I learned to do this at one of Rick's Double Impact traing classes years ago) but I add a "name" property to all the buttons in the form and set it to the same value; lets say 'name="bntSubmit"'. The "value" property is different for each button such as you show; 'value="Save"', or 'value="Cancel"'. Then in your server side code you would do this:

lcAction = Request.Form('btnSubmit')

This will return the "value" property from the button pressed. Next you can use a CASE or IF statment to act on the button that was pressed.

The above assumes you are using classic WebConnection process methods for your app. However, I think it should work just as well with the Web Control Framework too...

Marty


Rick ...Adding another button ... no problem.

What I don't understand is how to change the form post action to reflect the correct button

Is this something that will be handled with JavaScript? Just not sure how to make the form react to the appropriate button

Any advice ....

Thanks in advance

Just add another submit button.

+++ Rick ---


I have the need to put two buttons on a form to designate different actions ... little unclear as to how to do that.

My form as the following associated with the form

<form name="Form1" id="Form1" method="POST" action="saverecord.mcg?Table=client&ID=C00-00000001 " onSubmit="" onreset="">


and the following submit button

<td><input title="Save" type="submit" value="Save" class="SaveButton"/> </td>

When the button is clicked it performs the action recorded with the form action

How do I add another button that will call to a different function ( Such as cancel what I'm doing)

Thanks in Advance

Roy







Viewing all articles
Browse latest Browse all 10393

Trending Articles