Need little help with form please...

liunx

Guest
Hi everyone,<br />
<br />
I have a site with a form on it <br />
( <!-- m --><a class="postlink" href="http://www.swedecom.com/orderdoman.htm">http://www.swedecom.com/orderdoman.htm</a><!-- m --> ). <br />
I have some feilds with a "*" symbol beside it. I want this fields to be required in order to submit the form.<br />
<br />
Anyone know what I have to do to get this to work??<br />
<br />
Thanks alot :)<br />
<br />
//Swedecom<!--content-->You may try the following<br />
<br />
<SCRIPT language="JavaScript"><br />
<br />
function check_form() <br />
{<br />
valid = true; // assume valid<br />
if (doc.form.fullname.value.length == 0)<br />
{ valid = false; alert('Please fill in the name');<br />
doc.form.fullname.focus(); return false; }<br />
}<br />
</SCRIPT><br />
<br />
<INPUT type="text" name="fullname" size="21" maxlength="21" value=><br />
<INPUT TYPE=button NAME="finished" VALUE="Send Now" onclick=check_form()><!--content-->Thanks alot for your help!<br />
<br />
Now, another small question. Is there any way I can program the form to send the users IP in the mail??<br />
<br />
Thanks again...<br />
<br />
//Swedecom<!--content-->In the document head:<br />
<br />
<script type="text/javascript"><br />
<!--<br />
function validateForm (f) {<br />
var required = ['Agare_Namn_Foretag', 'Toppdoman'];<br />
for (j=0; j<required.length; j++) {<br />
var e = f[required[j]];<br />
switch (e.type) {<br />
case 'text' :<br />
if (e.value.length == 0) {alert ('Fields marked with astrices are required.'); e.focus(); return false}<br />
break;<br />
case 'select-one' :<br />
if (e.selectedIndex < 0) {alert ('Fields marked with astrices are required.'); e.focus(); return false}<br />
}<br />
}<br />
return false;<br />
}<br />
// --><br />
</script><br />
<br />
And then as the form tag:<br />
<br />
<FORM METHOD=POST ACTION="/cgi-bin/formmail.cgi" onsubmit="return validateForm(this)"><!--content-->Thanks again :)<br />
<br />
Is there any way I can program the form to send the users IP-number in the mail?? <br />
<br />
//Swedecom<!--content-->I see you are using formmial.pl (something I would not recommend). In the documentation, it will tell you how to include the IP number in the email...<!--content-->Thanks Pyro and Dave Clark:)<br />
<br />
Pyro, what are you recommend instread of formamail.pl ??<br />
<br />
//Swedeom<!--content-->Basically, anything... :) Formmail was listed at number 3 for the top 10 attacks for the 1st quarter of 2002 ( <!-- m --><a class="postlink" href="http://www.securityfocus.com/corporate/research/top10attacks_q1_2002.shtml">http://www.securityfocus.com/corporate/ ... 2002.shtml</a><!-- m --> ) If a PHP script is ok, please look at <!-- m --><a class="postlink" href="http://forums.webdeveloper.com/showthread.php?s=&threadid=9543">http://forums.webdeveloper.com/showthre ... eadid=9543</a><!-- m -->. If not, post in the CGI forum and I'm sure someone will help you...<!--content-->
 
Back
Top