HTML form/ emailing

liunx

Guest
Can any one get me the code to do the following?:<br />
<br />
1. User clicks on a link/picture <br />
<br />
2. Up pops a alert box (something they can't get out of without answering) that blocks them from getting back to the site they're on without answering. <br />
<br />
3. In the box are 2 questions and a submit button. <br />
<br />
4. They fill in the boxes and click submit. <br />
<br />
5. If both boxes aren't filled, nothing happens (box stays there). <br />
<br />
6. If both are, it emails the answers to a specified email and closes the box, allowing the user to continue doing whatever he/she was doing. <br />
<br />
Is it possible? <br />
<br />
<br />
best regards, <br />
agthepoet<!--content-->You can use confirm to ask a OK/Cancel question:<br />
<br />
<br />
var returnValue = confirm('Click OK or Cancel');<br />
alert(returnValue);<br />
<br />
<br />
Not sure exactly what context you want it in. You can validate a form something like this:<br />
<br />
<br />
<script type="text/javascript"><!--<br />
function validateForm(formObject) {<br />
if (formObject.name.value.length == 0 || formObject.email.value.length == 0) {<br />
alert('Please fill in the required form elements');<br />
return false;<br />
} else<br />
return true;<br />
}<br />
//--></script><br />
<form action="server_side_page.pl" onsubmit="return validateForm(this);"><p><br />
<input name="name" /><br />
<input name="email" /><br /><br />
<input type="submit" /><br />
</p></form><br />
<br />
<br />
Note though that you should use your server side page (server_side_page.pl in this case) to recheck this, as not everyone has a JavaScript enabled browser.<!--content-->
 
Back
Top