Forums
This topic is locked
random number script modification
Posted 27 Jan 2004 16:23:40
1
has voted
27 Jan 2004 16:23:40 sander kerstens posted:
hi scriptersi need this script to be modified so the random number value will be put in a hidden field called orderid
<%
Dim strrandom
Randomize
Random_Number_Min = 7825874
Random_Number_Max = 48798548789645
Random_Number = Int(((Random_Number_Max-Random_Number_Min+1) * Rnd) + Random_Number_Min)
Response.Write "Random Number = "& Random_Number &" <br>"
%>
i suppose the response.write needs to be replaced but have no clue with what..
thanks for youre time
greets Sander
Replies
Replied 27 Jan 2004 19:17:01
27 Jan 2004 19:17:01 Dan Berdusco replied:
You should be able to simply add a hidden form field like this:
<pre id=code><font face=courier size=2 id=code> <input type="hidden" name="orderid" value="<%= Random_Number %>"></font id=code></pre id=code>
and if you don't want the random number to be displayed on the page, take out the the last line of the script:
<pre id=code><font face=courier size=2 id=code> <%
Dim strrandom
Randomize
Random_Number_Min = 7825874
Random_Number_Max = 48798548789645
Random_Number = Int(((Random_Number_Max-Random_Number_Min+1) * Rnd) + Random_Number_Min)
%>
</font id=code></pre id=code>
<pre id=code><font face=courier size=2 id=code> <input type="hidden" name="orderid" value="<%= Random_Number %>"></font id=code></pre id=code>
and if you don't want the random number to be displayed on the page, take out the the last line of the script:
<pre id=code><font face=courier size=2 id=code> <%
Dim strrandom
Randomize
Random_Number_Min = 7825874
Random_Number_Max = 48798548789645
Random_Number = Int(((Random_Number_Max-Random_Number_Min+1) * Rnd) + Random_Number_Min)
%>
</font id=code></pre id=code>
Replied 27 Jan 2004 19:32:22
27 Jan 2004 19:32:22 sander kerstens replied:
yep this works no i have another question what if i wanted to upload this value to the database with the insert record behavior...
i changed the hidden field to text but i does not appear in the insert record behavior dialog box...
thank for youre help so far
greetz Sander
i changed the hidden field to text but i does not appear in the insert record behavior dialog box...
thank for youre help so far
greetz Sander
Replied 27 Jan 2004 19:35:17
27 Jan 2004 19:35:17 Dan Berdusco replied:
Make sure that the hidden field is located between you opening and closing form tags.
Replied 27 Jan 2004 20:15:18
27 Jan 2004 20:15:18 sander kerstens replied:
this is the situation now what is wrong i can't seem to find it
this is a part of the total code
<table width="449" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="449" height="421" valign="top"><form name="form1" method="POST" action="<%=MM_editAction%>">
<table width="200" border="1">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("naam".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("straat".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("postcode".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("woonplaats".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("telefoon".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("email".Value)%></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<%
Dim strrandom
Randomize
Random_Number_Min = 7825874
Random_Number_Max = 48798548789645
Random_Number = Int(((Random_Number_Max-Random_Number_Min+1) * Rnd) + Random_Number_Min)
response.write "<input type=""text"" name=""orderid"" value=""" & Random_Number & """>"
%>
</table>
<input name="textfield3" type="text" value="<%= Request.Form("orderid" %>">
<input name="textfield" type="text" value="<%=(klantzien.Fields.Item("klantid".Value)%>">
<input name="textfield2" type="text" value="<%=(vestigin.Fields.Item("vestiging".Value)%>">
<input type="submit" name="Submit" value="Submit">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
<p> <br>
</p></td>
</tr>
</table>
thanks
this is a part of the total code
<table width="449" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="449" height="421" valign="top"><form name="form1" method="POST" action="<%=MM_editAction%>">
<table width="200" border="1">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("naam".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("straat".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("postcode".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("woonplaats".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("telefoon".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("email".Value)%></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<%
Dim strrandom
Randomize
Random_Number_Min = 7825874
Random_Number_Max = 48798548789645
Random_Number = Int(((Random_Number_Max-Random_Number_Min+1) * Rnd) + Random_Number_Min)
response.write "<input type=""text"" name=""orderid"" value=""" & Random_Number & """>"
%>
</table>
<input name="textfield3" type="text" value="<%= Request.Form("orderid" %>">
<input name="textfield" type="text" value="<%=(klantzien.Fields.Item("klantid".Value)%>">
<input name="textfield2" type="text" value="<%=(vestigin.Fields.Item("vestiging".Value)%>">
<input type="submit" name="Submit" value="Submit">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
<p> <br>
</p></td>
</tr>
</table>
thanks
Replied 28 Jan 2004 19:03:40
28 Jan 2004 19:03:40 Dan Berdusco replied:
Try this instead:
<pre id=code><font face=courier size=2 id=code><table width="449" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="449" height="421" valign="top"><form name="form1" method="POST" action="<%=MM_editAction%>">
<table width="200" border="1">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("naam".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("straat".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("postcode".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("woonplaats".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("telefoon".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("email".Value)%></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<%
Dim strrandom
Randomize
Random_Number_Min = 7825874
Random_Number_Max = 48798548789645
Random_Number = Int(((Random_Number_Max-Random_Number_Min+1) * Rnd) + Random_Number_Min)%>
</table>
<input name="orderid" type="text" value="<%= Random_Number %>">
<input name="textfield3" type="text" value="<%= Request.Form("orderid" %>">
<input name="textfield" type="text" value="<%=(klantzien.Fields.Item("klantid".Value)%>">
<input name="textfield2" type="text" value="<%=(vestigin.Fields.Item("vestiging".Value)%>">
<input type="submit" name="Submit" value="Submit">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
<p> <br>
</p></td>
</tr>
</table> </font id=code></pre id=code>
<pre id=code><font face=courier size=2 id=code><table width="449" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="449" height="421" valign="top"><form name="form1" method="POST" action="<%=MM_editAction%>">
<table width="200" border="1">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("naam".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("straat".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("postcode".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("woonplaats".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("telefoon".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("email".Value)%></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<%
Dim strrandom
Randomize
Random_Number_Min = 7825874
Random_Number_Max = 48798548789645
Random_Number = Int(((Random_Number_Max-Random_Number_Min+1) * Rnd) + Random_Number_Min)%>
</table>
<input name="orderid" type="text" value="<%= Random_Number %>">
<input name="textfield3" type="text" value="<%= Request.Form("orderid" %>">
<input name="textfield" type="text" value="<%=(klantzien.Fields.Item("klantid".Value)%>">
<input name="textfield2" type="text" value="<%=(vestigin.Fields.Item("vestiging".Value)%>">
<input type="submit" name="Submit" value="Submit">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
<p> <br>
</p></td>
</tr>
</table> </font id=code></pre id=code>
Replied 28 Jan 2004 19:47:33
28 Jan 2004 19:47:33 sander kerstens replied:
yep this works thanks very much.....
Try this instead:
<pre id=code><font face=courier size=2 id=code><table width="449" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="449" height="421" valign="top"><form name="form1" method="POST" action="<%=MM_editAction%>">
<table width="200" border="1">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("naam".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("straat".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("postcode".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("woonplaats".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("telefoon".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("email".Value)%></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<%
Dim strrandom
Randomize
Random_Number_Min = 7825874
Random_Number_Max = 48798548789645
Random_Number = Int(((Random_Number_Max-Random_Number_Min+1) * Rnd) + Random_Number_Min)%>
</table>
<input name="orderid" type="text" value="<%= Random_Number %>">
<input name="textfield3" type="text" value="<%= Request.Form("orderid" %>">
<input name="textfield" type="text" value="<%=(klantzien.Fields.Item("klantid".Value)%>">
<input name="textfield2" type="text" value="<%=(vestigin.Fields.Item("vestiging".Value)%>">
<input type="submit" name="Submit" value="Submit">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
<p> <br>
</p></td>
</tr>
</table> </font id=code></pre id=code>
Try this instead:
<pre id=code><font face=courier size=2 id=code><table width="449" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="449" height="421" valign="top"><form name="form1" method="POST" action="<%=MM_editAction%>">
<table width="200" border="1">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("naam".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("straat".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("postcode".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("woonplaats".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("telefoon".Value)%></td>
<td> </td>
</tr>
<tr>
<td><%=(klantzien.Fields.Item("email".Value)%></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<%
Dim strrandom
Randomize
Random_Number_Min = 7825874
Random_Number_Max = 48798548789645
Random_Number = Int(((Random_Number_Max-Random_Number_Min+1) * Rnd) + Random_Number_Min)%>
</table>
<input name="orderid" type="text" value="<%= Random_Number %>">
<input name="textfield3" type="text" value="<%= Request.Form("orderid" %>">
<input name="textfield" type="text" value="<%=(klantzien.Fields.Item("klantid".Value)%>">
<input name="textfield2" type="text" value="<%=(vestigin.Fields.Item("vestiging".Value)%>">
<input type="submit" name="Submit" value="Submit">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
<p> <br>
</p></td>
</tr>
</table> </font id=code></pre id=code>