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!

How do I get the value of a hidden field? 1

Status
Not open for further replies.

Nosh

Programmer
Jul 12, 2001
34
GB
Hi Folks,

I'm a bit stuck. I have the following hidden field:

<input name=&quot;number_of_lines&quot; type=&quot;hidden&quot; value=&quot;3&quot;>

This hidden input holds the value of the last order line number.

I need to display an empty line to allow further data entry and the line number needs to be equal to the value of number_of_lines + 1.

How can I do this?

Cheers
Nosh
 
would
document.forms.formname.hiddenname.value+1
do the job? Victor
 
Hi,

Thanks for responding. I tried this and I get no result. Have I done it properly?

<TD width=&quot;10%&quot; align=&quot;middle&quot; valign=&quot;center&quot;>
<FONT size=&quot;2&quot;>
<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>
javascript:document.forms[0].ril_lines.value+1
</script>
</FONT>
</TD>

Thanks
Nosh
 
no'p
try
<TD width=&quot;10%&quot; align=&quot;middle&quot; valign=&quot;center&quot;><FONT size=&quot;2&quot;>
<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>
document.write(eval(document.forms[0].ril_lines.value)+1)
</script>
</FONT></TD>


Victor
 
or document.write(eval(document.forms[0].ril_lines.value+'+1')) or something like that, but this way; or thru other text field
Victor
 
I think we are getting there. The response came up as NaN. This is because the value in ril_lines is a String. Is there anyway to convert it to a number in javascript.

Thanks for all you help.
 
i thought it would be parsed by eval.. well, if it wasn't, try

<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>
<!--
var val,rez
val=parseInt(document.forms[0].ril_lines.value)
//or
//val=Number(document.forms[0].ril_lines.value) //but i'm not shure about this one..
rez=val+1
document.write(rez)
//-->
</script>


Victor
 
Brilliant - you are a star!

I'll buy you a pint next time your'e in Cardiff!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top