How to give confirm message before update operation?

How to give confirm message before update operation?

Good Afternoon people,

I am importing XML contents into database. Before import, I have applied the check whether record is already present or not. 

If record is present I am updating it.

But before update happens, I want to take permission of user. If user clicks "Yes", it should update else it shouldn't update and come out.

How can I give confirm message inside action?

Thanks and Regards,
Suraj Borade
You can't, at least not easily. Your action runs Server Side, while your question runs Client Side. What you could do as a work-around, is checking the existence of the record in an action that returns a boolean, and based on that boolean you have either an empty Confirmation Message on the button or the question. There's one catch: the action is run when the page is rendered, so if you need to react to input, you need to Ajax Refresh the button before the user clicks it (i.e. when the relevant data changes).

I understand that in your case this might not be feasible, as you are apparently importing and updating in one go, so you may need to do some trickery with hidden buttons and WidgetClicks etc. to get what you want.

2 stage import.

first import the xml into a temp-table with a boolean and a status (already exists, UserAllowsUpdate)
then present is on the screen.
user can filter on the records he needs to confirm.

hit the button, and move the data from temp to real table.

or make it a BPT-process *shivers*

then you will import the data.
import it for real.