I have an issue where I’m reusing the dialog so I wouldnt have to duplicate the code. The issue I’m having is when I click an “Add New” button, I have as button “save” and “cancel”. The save button in the dialog handles saving the information. If I click the “Edit Existing” button to edit my information, I would like the “save” button to change to an “edit” button. Is this possible?
Share
I think what you’re trying to do is, at runtime, change the text of the buttons depending on the user action. This discussion involving Richard Worth may help, and it’s what I’ve had to use in order to accomplish what you’re trying to do.
Basically, what you are trying to do isn’t possible by defining the buttons array as an object literal (inline in the dialog definition). What you should do is define your buttons array outside the dialog initialization; your array indexes can be your label text (as you’ll see in the message discussion example). Then, when you initialize the array, you just assign the buttons property to your buttons array.
In pseudo-code, you’ll do this:
Hope this helps!!