Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prompt to Save

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
0
0
US
I'm using the below script to prompt a user to save once the exit button is clicked.

<script type="text/javascript">
function SavePopup(sender, args) {
args.set_cancel(!window.confirm("Do You Need to Save This Data ?"));
}
</script>

What I need to do is check if the save button is enabled before firing off the script. Not sure how to do that. Save button is called b2 So if b2 is enabled run the script and if b2 is NOT enabled, ignore the script.


Any help would be appreciated

Thanks
 
Not sure exactly what you mean,
How are you disabling the save button? If the button is disabled, how is it being clicked?



----------------------------------
Phil AKA Vacunita
----------------------------------
OS-ception: Running Linux on a Virtual Machine in Windows which itself is running in a Virtual Machine on Mac OSx.

Web & Tech
 
sorry, this is running off the cancel button. sorry about that. so if the user clicks the cancel button I need the script to check if the save button is enabled and if so prompt the user to save the work, if the save button is not enabled, ignore and exit the form.
 
Again, what save button?

How is your safe button not enabled? What do you do to disable it?

Does this script run when the save button is clicked? Or how does it get activated?







----------------------------------
Phil AKA Vacunita
----------------------------------
OS-ception: Running Linux on a Virtual Machine in Windows which itself is running in a Virtual Machine on Mac OSx.

Web & Tech
 
the save button is disabled the script gets ran from the cancel button
<telerik:RadButton ID="b2" runat="server" ButtonType="LinkButton" Text="Exit Form" CssClass="leftAlign" OnClientClicking="SavePopup">
<Icon PrimaryIconCssClass="rbCancel" PrimaryIconLeft="7" PrimaryIconTop="7" />
</telerik:RadButton>

 
@dvannoy, perhaps, if you were able to provide a sample of what the properties of the "button" look like in both states will help.

That said, I employ two type tactics for this:
(1) Use a hidden field and set a value 0 or 1 and check this field. So, whenever your button property is set to ON, set the value of the hidden field to 1 and if OFF, set the value to 0.

(2) Use JQuery to read the attribute value of the component/element and take action accordingly.

Hope this helps!!!!


--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
The un-processed ASP code is of no use. JS does not see the ASP code only the actual HTML results from it.

As southbeach implies above, we need to know how the Save Button is set to be disabled. In other words what it is you want to check in the button to verify its disabled. It has to have some property that makes it disabled. What is it?

Basically you can target the button by ID if it has one or by name if it's part of a form. But so far you have told us nothing about this save button, and the un-processed ASP code is of no use.

If you post the source code after having loaded the page on a browser, we may be able to help more.

As it is, we can't even guess at what it is you need to do to verify your button is disabled.

----------------------------------
Phil AKA Vacunita
----------------------------------
OS-ception: Running Linux on a Virtual Machine in Windows which itself is running in a Virtual Machine on Mac OSx.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top