Hi All,
I am having one requirement that I need to disable the new button after the save button is clicked. New and Save are standard system buttons in form.
Please guide me where i have to write code.
Thanks in advance.
Thanks Andrew for your reply.
Hi JohnPaul,
Is there any business impact in case a user by accident clicks twice on the new button? Sometimes, I also do that, but can delete the wrong record. If there is no business impact, why adding logic to change the standard behavior of the application?
If you need to have a user creating one record at a time, you can consider developing a creation dialog instead, like the customer creation form, sales/purchase order creation dialog.
Hi PJ,
You can make it work by overwriting write() method of your data source.
Clicking button Save will call that method, and you can set 'allowCreate' to false to make button New disabled.
Your requirement is still not clear, generally on click of New button, one record is created. Even if you disable New button and enable it on click of Save button, user still can create multiple records. How are you going to restrict it?
JohnPaul,
Tell us the document where the record is being created.
Does the document have workflow enabled?
Does the requirement say, a Maximum of one record per user on the table?
If yes, you might consider indexes and disallow duplicate.
Disabling the "New" button to stop multiple record is not an ideal design.
Normally when you click on save button validateWrite method will be called and it will validate the current record and if it's an error it won't allow you to create a next new record otherwise it will allow you create new record.
This is how it will work.
If you want the user to won't allow to create next record without giving proper value on the current record you need to add validation for that. Trying to enable and disable a new button is not a good idea, I guess.
Whatever you are trying to achieve is not possible, I think.
Thanks,
Girish S.
Hi Mohit,
Thanks for your response.
Now its allowing the user to create multiple records,
we need to restrict that
For that reason we want to disable new button after save button clicked we can enable the new button again
Hi Girish,
Thanks for the response.
Actually what i want is after clicking new button,it should get disabled.
When the user click on save button at the time only new button should get enabled.
After saving record only ,user should able to click the new button,until the record is saved,user should not able to click on new button
Hi, May I know why do you need to disable the New button. It's a standard functionality to create new records after saving current record. You can check Customer groups form.
HI,
If you hide the new button after saving it won't be available for next record creation. I mean it will be disabled all the time until you open and closes the form.
Can you elaborate what you want to achieve?
Thanks,
Girish S.
André Arnaud de Cal...
292,160
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156