Apr 05, 2010, 4:27 PM
[CLOSED] Prompt before DirectEvent
Hi,
I have a javascript function that will ask users if ok to proceed.
I thought that by returning false, the direct event would be cancel..but the success event fires even before the user can answer the confirmation..
Button:
I have a javascript function that will ask users if ok to proceed.
I thought that by returning false, the direct event would be cancel..but the success event fires even before the user can answer the confirmation..
function CheckForSectorChange()
{
if ((#{hidInitSectorTeam}.getValue() != #{cmboSectorTeam}.getValue()) | (#{hidInitAnalyst}.getValue() != #{cmboAnalyst}.getValue()))
{
Ext.Msg.confirm('Workflow Restart', 'You are changing either the sector team, or the analyst for a fund that has a running Investment Review. If you continue, you will be restarting the workflow. Do you agree?', function(btn, text) {
if (btn == 'yes')
{
return true;
}
else
return false;
});
}
else
return true;
}
Button:
<ext:Button runat="server" ID="Button2" Text="Save" Icon="Disk">
<DirectEvents>
<Click OnEvent="ChangeDetail" Before="CheckForSectorChange();" Failure="Ext.Msg.alert('Failure',result.errorMessage);#{winDetailChange}.hide(); "
Success="UpdateDetailLabels(); #{winDetailChange}.hide(); Ext.Msg.alert('Success','Details have been saved.');">
<ExtraParams>
<ext:Parameter Name="ListValues" Value="Ext.encode(#{lstStyles}.getRowsValues())"
Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>