
July 5th, 2012, 01:56 PM
|
|
Registered User
|
|
Join Date: Jul 2012
Posts: 1
Time spent in forums: 41 m 41 sec
Reputation Power: 0
|
|
|
HTML and Coldfusion
I am tring to create a random string (unique string), place that string in a hidden field, save it to a table and then pass it and use it in another form. I'm trying to do this with an HTML form and a cold fusion form.
This is what I have so far but, it's not creating the random string. I call randomString when I load the form.
<script language="javascript" type="text/javascript">
function randomString() {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmno pqrstuvwxyz";
var string_length = 8;
var randomstring = '';
for (var i=0; i<string_length; i++) {
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum,rnum+1);
}
document.testform.UniqueNum.value = randomstring;
}
</script>
<input name="UniqueNum" id="UniqueNum" type="hidden" value="#UniqueNum#">
This is what I have on the ColdFusion side.
<cfif isdefined("form.UniqueNum") and len(form.UniqueNum)>
#form.UniqueNum#<br>
</cfif>
Thanks.
|