Auto Save & Close Form based on Field Selection

I would like to have a form auto save and close once a selection is made on the Edit form. The control is a drop down, once that drop down is not empty the form should save and close.

Hi Stefanie,

Please check this code:

fd.field('DropdownInternalName').$on('change', function(value) {
     if (value) {
         fd.save();      
     }
});

Notice that you should replace ‘DropdownInternalName’ with an internal name of your Dropdown field.

That did not work. I did change the field name to my internal field name.

Do you place this code in spRendered() event handler?
Should look like this:

fd.spRendered(function() {
   fd.field('DropdownInternalName').$on('change', function(value) {
     if (value) {
         fd.save();      
     }
   });
});

Still not working, it is a look up field if that matters.

Ok, could you please provide your code and a screenshot of your Form with the field settings?

Code - fd.spRendered(function() {
fd.field('Name_x003a_Sign_x0020_in_x0020_I').$on('change', function(value) {
if (value) {
fd.save();
}
});
});

Form

Dear Stefanie,
The code should work, unless there is some error in JavaScript. Can you open the form in the browser, try to select a value and if saving doesn’t happen, check the browser’s console for errors? If there are any, please, send us a screenshot.

I figured it out, you are correct the code was accurate.
I removed the look up field and re added it and the internal name was different. Used that internal name and it worked as expected.

As always thank you for the assist.