Hi,
I have this form - test page here:
http://jimpix.co.uk/ecards/test.asp?id=4549&tag=type-your-own-message&c=1#swf
I have a button at the top of the page:
<button type="button" value="Refresh ecard above with your own content »" id="button0" name="button0" onclick="return onbutton0();">Refresh ecard above with your own content »</button>
Linked to this javascript:
function onbutton0()
{
document.theForm.action = "normal-ecard.asp?id=<%=e%>&tag=<%=tag%>&c=<%=c%>#swf"
document.theForm.submit(); // submit the page
return true;
}
Then there’s a “Preview” button at the bottom - a regular “submit” button, which calls a javascript function to validate the form input, called via this in the form HTML:
<form method="post" action="preview.asp" name="theForm" id="theForm" style="padding:0px; border:0px;" onsubmit="return valForm(this)">
Usually people have to preview the ecard before sending it, but I’d like to add an option to allow people to send right away, without the preview bit.
However, I can’t see how to do it, because the action on the form is to send the user to “preview.asp”.
The page to send directly is called “process.asp”.
However, I can’t just add this:
function onbuttontest()
{
document.theForm.action = "process.asp"
document.theForm.submit(); // submit the page
return true;
}
And this:
<button type="button" value="Send Immediately" id="onbuttontest" name="onbuttontest" onclick="return onbuttontest();">Send Immediately</button>
Because then the form validation function (valForm) will not be called.
I tried this:
<button type="button" value="Send Immediately" onclick="return valForm(this)">Send Immediately</button>
But that doesn’t work…
I wonder if there is a way I can do it - any advice much appreciated.
Thanks!