Click to See Complete Forum and Search --> : form action


glotsa
02-24-2003, 12:29 AM
function saveForm() {
var thisForm = document.MC;
thisForm.submit();
}

function submitForm() {
var thisForm = document.MC;
thisForm.submit();
}


<BODY>Login Form:<BR>
<BR>
<FORM name="MC" method="POST" action="/WebServlet?action=ConfirmScore">
<INPUT type="submit" name="Submit"><a href="Javascript:submitForm();">
<INPUT type="submit" name="Save"><ahref="Javascript:saveForm();">
</FORM>
</BODY>

In my code, there are two buttons, one is "save" and another one is "submit".
After clicked save or submit, the form will be submitted to "/WebServlet?action=ConfirmScore". Now i want to modify the code to:
when click "save" button, the form will be submitted to "/WebServlet?action=ConfirmScore", but when click "submit", can the form be submitted to "/WebServlet?action=FullForm"??

so that the action value is diiferent due to different event??

khalidali63
02-24-2003, 12:34 AM
Yes you should be able to that.here is your submit function with a bit of change

function submitForm() {
var thisForm = document.MC;
thisForm.action="/WebServlet?action=FullForm";
thisForm.submit();
}

The above should take care of your concern..

I have not tested that if this will override the initial value,if it doesn't then just add the appropriate line in the save function as well and in the form leave the action="" attribute without any value.


Cheers

Khalid

glotsa
02-24-2003, 12:49 AM
Thanks, it can work correctly after the modifcation u suggested :P