Expand my Community achievements bar.

Adding Control Number to Form

Avatar

Former Community Member
I am new to LiveCycle Designer. Is there anyway to add a control number to forms? I would like to have it so that when the form is submitted, the form number will increase by one. Any suggestions?
24 Replies

Avatar

Level 10
And here it is in javascript should anyone want it. This gives a 10 digit number.



var d = new Date();

//divide result by 1000 to get seconds and round off

this.rawValue = parseInt(d / 1000);



This has been a good excercise. I'm just getting into the scripting after not having done anything coding-like for about 20 years.

Avatar

Level 10
Thanks Jono,



I had not come across parseInt before. One for the books ;-)



N.

Avatar

Level 10
Theodoros:



I'm trying to figure out how to stop the field from changing too.



I found the following formcalc code on the AUC forums http://www.acrobatusers.com/forums/aucbb/viewtopic.php?pid=43197



if ($.rawValue==null)then

$.rawValue = time()

else $.rawValue

endif



and modified it for my javascript:



if (this.rawValue == null) {

var d = new Date();

//divide result by 1000 to get seconds and round off

this.rawValue = parseInt(d / 1000);

}

else {

this.rawValue = rawValue;

}



I tried saving the form with the generated number and it didn't regenerate on opening. It probably needs to be more robust than this for general use but it works enough for my testing purposes.