Hello All, I've followed the video tutorial on the subject and when a new record is added the correct default value shows in the select box. However when the record is saved the new value is null. Here's my code.
if(nuIsNewRecord()){
$('#OutContidion').val(1).change;
}
The value 1 has the word New attached to it and New is what is shown in the selection box. Anyone have an idea what the issue might be?
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Set default values in form
Re: Set default values in form
Additional info, even selecting the "New" value from the select box does saves a null value. If the record is edited the chosen value does save.
Re: Set default values in form
Thanks! sometimes another set of eyes helps. Added the () and all works. And now when I go to leave the page I've got to cancel the changes because the code starts the edit process. Perhaps that code can go under a different event. Looks like it would need to be PHP to do that though.
-
- nuBuilder Team
- Posts: 4299
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: Set default values in form
Add nuHasNotBeenEdited(); after changing the field.treed wrote:And now when I go to leave the page I've got to cancel the changes because the code starts the edit process. Perhaps that code can go under a different event. Looks like it would need to be PHP to do that though.
Wiki wrote:This will set the status of an Edit Form to not Edited and do 2 things
The Save Action Button will return to its normal color.
The web browser will not alert the user when leaving the current record.
Code: Select all
if (nuFormType() == 'edit') {
$('#OutContidion').val(1).change();
nuHasNotBeenEdited();
}
Re: Set default values in form
Again, Thank you very much. Is there a reference somewhere for all these nice JavaScript functions???