Moderators: Derry, Goldie, Harpo
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Junior Mechanic
Posted
I want add a form on my site which visitors can download and print on their printer. The main feature in my form I want is that each form should have unique serial number. I would be obliged if any one can help me.
 
Posts: 3 | Registered: October 12, 2005Reply With QuoteEdit or Delete MessageReport This Post
Guru 'Power' Mechanic
Picture of Bruceee
Posted Hide Post
If you want something "guaranteed unique", you will probably need a script on your server that bumps a serial number each time the page is downloaded -- like a page hit counter.

If "usually unique" is good enough, then with Javascript you could create a serial number on-the-fly -- based on the visitor computer's date/time (down to a fraction of a second).
 
Posts: 9228 | Location: Wellington, New Zealand | Registered: December 11, 2003Reply With QuoteEdit or Delete MessageReport This Post
Junior Mechanic
Posted Hide Post
"usually unique" can solve my problem can you please help with java script
 
Posts: 3 | Registered: October 12, 2005Reply With QuoteEdit or Delete MessageReport This Post
Guru 'Power' Mechanic
Picture of Bruceee
Posted Hide Post
This should give you a most impressive serial number!

1. Add a text box to your form, and make it big enough to hold a serial number like "1163995512390" which is the one I just created.

2. From the Form Text Box tab, check the box "Read Only"

3. Also from the Form Text Box tab, note the name of your form (labelled "Form") and the name of the text box (labelled "Name"). You need to include those in the following code:

4. Add this code object to your page (no CSS positioning), and make sure it stays after your form on the page (nearer 'to front')
<script type="text/javascript" language="JavaScript">
function SerialNo() {
var currentDate = new Date() 
return currentDate.getTime()
}
document.formMyForm.myTextBox.value=SerialNo()
</script> 

5. For formMyForm in the code, substitute the name of your form. For myTextBox substitute the name of your text box.
 
Posts: 9228 | Location: Wellington, New Zealand | Registered: December 11, 2003Reply With QuoteEdit or Delete MessageReport This Post
Junior Mechanic
Posted Hide Post
Thank you very much. This have worked very fine.
 
Posts: 3 | Registered: October 12, 2005Reply With QuoteEdit or Delete MessageReport This Post
  Powered by Eve Community  
 


™ & © 1998 - 2008, Virtual Mechanics Inc. All rights reserved.