Button for changing a field's value, save and close the form
Hello !
I have an issue form, and I want to add a button "Close the case", a button that changes the value of the "Status" field, do some other things, saves and closes the form.
I added a button, added this code in OnClick :
fd.field('Status').value('Résolu');
fd.save().click();
But it doesn't work.
It sets the status value well, and refreshes the form.
But :
_ The form is still open.
_ And if I close the form (just close, with the little red cross in the top right corner of the form box), it appears the Status field's value is always the previous value ! So the submission doesn't work.
Can you help me ?
Thank you in advance !
I have an issue form, and I want to add a button "Close the case", a button that changes the value of the "Status" field, do some other things, saves and closes the form.
I added a button, added this code in OnClick :
fd.field('Status').value('Résolu');
fd.save().click();
But it doesn't work.
It sets the status value well, and refreshes the form.
But :
_ The form is still open.
_ And if I close the form (just close, with the little red cross in the top right corner of the form box), it appears the Status field's value is always the previous value ! So the submission doesn't work.
Can you help me ?
Thank you in advance !
Hello Leslie,
You need to add a custom button in the form and then add your code in the OnClick property of the button. Then it should work.
Otherwise, please check if there any errors in the console (F12) and share the screenshot so I could troubleshoot the issue.
You need to add a custom button in the form and then add your code in the OnClick property of the button. Then it should work.
Otherwise, please check if there any errors in the console (F12) and share the screenshot so I could troubleshoot the issue.
Solved !
It was because the Statuts field was in readonly. (in another function of the JS to "protect" the Status field, with fd.field('Status').readonly(true);)
Without the readonly, the field can be changed et saved.
I don't know if it's normal or not, but it works.
It was because the Statuts field was in readonly. (in another function of the JS to "protect" the Status field, with fd.field('Status').readonly(true);)
Without the readonly, the field can be changed et saved.
I don't know if it's normal or not, but it works.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 12 guests