Hi NB Team happy new year.
I just need to generate a random 9 digit number after ADD RECORD button are pressed and update field value with it. Sorry to say i have tried JS on Custom Code After Open tab but no results please give an advice or clue
Thanks guys.
Welcome to the nuBuilder forums!
Please register and login to view forums and other content only available to registered users.
Please register and login to view forums and other content only available to registered users.
How to replace field value with a random number
-
- Posts: 11
- Joined: Fri Aug 16, 2013 4:14 pm
-
- Posts: 503
- Joined: Thu May 24, 2012 2:08 am
- Location: Milan, Italy
- Contact:
Re: How to replace field value with a random number
After Open tab??Ralcala wrote:... i have tried JS on Custom Code After Open tab ...
Javascript code must be inserted in Javascript tab: all other tabs in Custom Code are for PHP code.
To make your job you could:
- insert js like this in Form > Custom Code > Javascript > nuLoadThis() function:
Code: Select all
function nuLoadThis() { $('#my_field').val(Math.floor(Math.random() * 999999999) + 1); }
- insert SQL code like this in Object > Default Value SQL field:
Code: Select all
SELECT FLOOR(1 + (RAND() * 999999999));
Max
-
- Posts: 11
- Joined: Fri Aug 16, 2013 4:14 pm
Re: How to replace field value with a random number
Thank you max. Kind as always thank you for your support.
-
- Posts: 503
- Joined: Thu May 24, 2012 2:08 am
- Location: Milan, Italy
- Contact: