Forum Moderators: open

Message Too Old, No Replies

Random number input into form field

         

Blelisa

2:07 pm on Sep 19, 2005 (gmt 0)

10+ Year Member



I have a form on a .asp page, the first field on this form is a ticket number. I want this field to be automaticlly filled in whenever someone open this page. I have put this code in my header:
<%
Dim intCounter, intDecimal, strPassword

For intCounter = 1 To 6
Randomize
intDecimal = Int((26 * Rnd) + 1) + 64

strPassword = strPassword & Chr(intDecimal)

Next
%>

Now what do I put in my field? I have tried this but it does not work, it just shows that code on the page:

<input name="number" type="text" id="number" value="=%strpassword%">

Any help is greatly appreciated!

txbakers

2:14 pm on Sep 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You are missing your brackets in the input tag:

<input name="number" type="text" id="number" value="<=%strpassword%>">

Blelisa

2:28 pm on Sep 19, 2005 (gmt 0)

10+ Year Member



I tried that but it still does not work. In the input box this is what shows:

<=%strpassword%>

emsaw

3:05 pm on Sep 19, 2005 (gmt 0)

10+ Year Member



I think it should be:

<input name="number" type="text" id="number" value="<% = strpassword %>">

HTH,
Mark

txbakers

5:31 pm on Sep 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



D'OH! Missed that one.