Solved

even i remove disabled hyperlink and hand icon still the process is goingon?how to restrict

Posted on 2007-11-30
3
663 Views
Last Modified: 2012-05-05
<a href="#" onclick="return SubmitForm('emp-header','emp-header:Approve');" id="Approve" type="submit" style="color: #FFFFFF;" class="enabledTabText">XXXX</a>


Depending the empStatus i am trying to disable hyperlink and also remove hand icon.both are disbled and hand icon is removed.

but the problem  is even though i removed disable hyperlink and removed hand icon still when user clicks on the hyperlink and the process is going.

            if(document.getElementById("empStatus").value == "Y")
                  {
                        document.getElementById("Approve").style.cursor='default';
                        document.getElementById("Approve").disabled = true;
                  }
0
Comment
Question by:chaitu chaitu
3 Comments
 
LVL 21

Expert Comment

by:nizsmo
ID: 20387263
Are you sure your condition is being met?

Try this and see if you get an alert box:

if(document.getElementById("empStatus").value == "Y")
                  {
                        alert("condition met");
                        document.getElementById("Approve").style.cursor='default';
                        document.getElementById("Approve").disabled = true;
                  }
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 20387268
i got an alert.you can try to replicate this scenario in ur system also.button is disabled and hand icon is removed but still i can click on that process going on to the server side.
0
 
LVL 36

Accepted Solution

by:
Zyloch earned 500 total points
ID: 20387292
This is the behavior because disabled is not a standard property of hyperlinks. If you want to disable a hyperlink, you can do several things. One is to temporary remove the href property, something like

document.getElementById("Approve").removeAttribute("href");

Then, you will still need to remove the onclick. The other method is again change around the onclick, then you can add a disabled style to the hyperlink using Javascript and style disabled links a certain way (default cursor, certain color, etc.)

Both methods, you need to switch the onclick. To disable, for example, you will need

document.getElementById("Approve").onclick = function() { return false; }
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now