I have the random number generator as a textbox. i can't be a ble to make it save the random number into the database using the dataset. The submit button(button1) is connected to the database with studentdetails dataset. This is the code
export function button1_click(event) { $w("#text3").text = (Math.floor((Math.random() * 20) + 1)).toString(); }
Any help will be appreciated.
thanks a lot!
If the button1 is the only connected to SUBMIT action of Dataset this won't work because you can't have two click events to one button. Then you must choose to code the whole saving process or add a datahook to the data collection onAfterSave and then use like item.randomFieldKey = (Math.floor((Math.random() * 20) + 1)).toString(); and then do an update on the data in the hook.