ClioSport.net

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • Due to ongoing maintenance work some features and functions (including Dark mode!) may be unavailable or visually appear differently.
  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

Form verification...

Car  Megane DCi 147bhp/350nwm
<form action="apply.asp" method=post id="Form1" name="Form1">
<td>&nbsp;</td>
<td valign="top" class="bodycopy">Company Name</td>
<td>&nbsp;</td>
<td class="bodycopy"><input name="company" type="text" id="broker_name">
</td>
</tr>
Anyone know a quick & easy verification for this form entry?

Such as "max character length 10" or if it was for a phone number to only allow "1234567890 ()+-"

etc. etc.
 
mehhh don't want all that shizzle!

surely it could be a case of 1 string line that validates entries?
 
script language="JavaScript" type="text/javascript">
var frmvalidator = new Validator("myform");
frmvalidator.addValidation("FirstName","req","Please enter your First Name");
frmvalidator.addValidation("FirstName","maxlen=20",
"Max length for FirstName is 20");
frmvalidator.addValidation("FirstName","alpha");


like that but i don't want to use java!?
 
if it was php, i would have put in the apply file and if command - if (firstname < 20 etc...) then { have your code. In asp, Iv forgot how you lay out an if command.

thats how id do it.
 
aye same. just search google for if command. then put all the code below the if command. and hopely it shud work. otherwise do it in php, and il write the if command for u.
 
you turkey.

To limit the number of characters are the following.

maxlength="10"

Yes you can use JS to validate the form client side.

here is some coding I use to validate forms.

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
 
If you use javascript remember the user can have it swtiched off bypassing your form validation.

You should always do a server side check, I suggest PHP not crappy asp ! ;)
 
He speaketh the truth ^.

Have JS to do basic checking, but back it up with severside checking. Maybe use AJAX to validate the form as you're entering it.
 
True, true.

He did mention quick and easy :)

If only my work used php!!!!

Then you could help me out :p

If you use javascript remember the user can have it swtiched off bypassing your form validation.

You should always do a server side check, I suggest PHP not crappy asp ! ;)
 
True, true.

He did mention quick and easy :)

If only my work used php!!!!

Then you could help me out :p

If you use javascript remember the user can have it swtiched off bypassing your form validation.

You should always do a server side check, I suggest PHP not crappy asp ! ;)

I actually used to program in ASP, but it was so long ago I am niether up to date, nor can remember anything. The only thing I can remember is having to write about 40 lines of asp code for the equivelant of about 10 lines of PHP. Maybe thats changed now I dont know ?

If your work ever does go to the dark side (PHP) I'll be happy to help..
 
I'm not "fluent" enough in PHP to trust myself to code a full site. Yes, i can do the basics but nothing extravagant!

Besides the fact that there are about 40intergrated addons that run from different sites and in different code.

I'm a designer more than a coder. I wish i could do both!

html/xml and all that shizzle is piss pants. PHP and java goggle my mind. Even html pisses me off!

:(:( </rant>

p.s

anyone on here anygood with asp?
 
Last edited:
Back
Top