HighDots Forums  

script to make fields mandatory

alt.html.tags alt.html.tags


Discuss script to make fields mandatory in the alt.html.tags forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ikkeboeken
 
Posts: n/a

Default script to make fields mandatory - 02-07-2004 , 05:39 AM






anyone know a simple java script to share that i could use to inform
customers that the data for a particular form field, checkbox, menu, etc...
is mandatory to be filled in in order to proceed. perhaps with a string as
well to use to validate an argument to check for @ in an email address,
etc...



Reply With Quote
  #2  
Old   
Will Gittoes
 
Posts: n/a

Default Re: script to make fields mandatory - 02-15-2004 , 01:38 AM






Ikkeboeken wrote:

Quote:
anyone know a simple java script to share that i could use to inform
customers that the data for a particular form field, checkbox, menu, etc...
is mandatory to be filled in in order to proceed. perhaps with a string as
well to use to validate an argument to check for @ in an email address,
etc...




In the button:
<input type="button" ... onClick="ValidateForm()" ... />

In the head tag:

<script>

function ValidateForm(){

// Variable shows that form has been filled in properly
var Completed = true

/* Now we have statements that define Completed as FALSE if there is
something missing in the form */

if(FORM_NAME.FIELD_NAME.value==""){Completed = false}

var BufferArray() = FORM_NAME.EMAIL_FIELD.value.split("@")
if(BufferArray[1]==false){Completed = false}

if(Completed==true){...do some shit, redirect to some page with submit
info}else{alert("Fill in the form properly, fuck-face!")}

}

</script>



Totally un-tested, use at own risk! You didn't give us much details there!


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.