Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Valiadation for hidden fields in Netscape

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I can't get my validation to work in Netscape I can’t use the value attribute because I am passing values from an array to the name attribute quant.
this is the code I am using
if ((document.signup.quant.value = "") ||(document.signup.quant.lenght = 0)")){
alert("Please make a purchase before you submit a order.")
return false;
}

<input type=&quot;hidden&quot; name=&quot;quant>
 
you're using the wrong operator. you need to use == not =

nick bulka

 
Still dosen't work in Netscape.

I can't get my validation to work in Netscape I can’t use the value attribute because I am passing values from an array to the name attribute quant.
this is the code I am using


if ((document.signup.quant.value == &quot;&quot;)||(document.signup.quant.lenght == 0)){
alert(&quot;Please make a purchase before you submit a order.&quot;)
return false;
}

<input type=&quot;hidden&quot; NAME=quant>
 
Leo Student,

You need to set an inital value for the hidden filed, otherwise when you call &quot;document.singup.quant.value&quot; it will give u an error.

try set your hidden filed like this.
<input type=&quot;hidden&quot; name=&quot;quant&quot; value=&quot;&quot;>

hope this helps

Chiu Chan
cchan@gefmus.com
 
Chiu,
If I use value=&quot;&quot;, Netscape sees it as always empty. If value was dynamic this would fix my problem.

Nick,
Some more code,

The full validation script is about 150 lines, but the rest works fine.
<!-- START OF SCRIPT -->
<script language=&quot;JavaScript1.2&quot;>
<!-- Hide code from non-js browsers
function checkData (){
formObject=document.signup;

if ((document.signup.quant.value == &quot;&quot;) || (document.signup.quant.length == 0)){
alert(&quot;Please make a purchase before you submit a order.&quot;)
return false;
}
// end hiding -->
</script>


<form name=&quot;signup&quot; method=&quot;post&quot; align=&quot;left&quot; ACTION=&quot;// onsubmit=&quot;return checkData()&quot;>

//If I set the type to text Netscape sees it and the script works fine. As a fix I would do this but Netscape whon't see Readonly so the user can chnge the values?

<input type=&quot;hidden&quot; name=&quot;ProductID&quot;>
<input type=&quot;hidden&quot; NAME=quant size=&quot;1&quot; Readonly>


//This is the script that I pass my values from (ProductID and quant) I just call it for a .js and declare the variables out side of the function.
<script>
checkout();
</script>

<input type=&quot;submit&quot; name=&quot;B1&quot;
value=&quot;Submit details&quot; >
</form>
 
I didn't run your code, but right off I can see that the checkData function has no ending }

Also, it's very unusual to have a function call inside a form. Can you post the checkout() code?

nick bulka

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top