Solved

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

Posted on 2007-11-30
3
667 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
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…

734 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