Solved

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

Posted on 2007-11-30
3
661 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
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…

744 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

9 Experts available now in Live!

Get 1:1 Help Now