set  the tab index to the other field which is disabled by JavaScript code

Posted on 2007-11-26
Last Modified: 2013-11-19
Hello EVERYONE, I set the tab index and it works whne the other field is enabled but it does NOT work when it's disabled, it skips right past it to the next enabled field... Is there any way to overcome this problem?

Thank you,
Angie H.      

<TD class="responseinside">
               <input type="text" value="<%=iProjectedPercentage5%>" tabindex=23 class="percentage" maxlength = "3" name="ProjectedPercentage5" id="ProjectedPercentage5"  onBlur="this.value=formatCurrency(this.value); projPercentage5(); specifyProjectedPercentageOther();" />&nbsp;<strong>%</strong>
        <TD class="responseinside"> Other: &nbsp;<input tabindex=24 style="width:150px; font-family: Verdana; font-size: 8pt" type="text" value="<%=sProjectedPercentageOther%>"  name="ProjectedPercentageOther" id="ProjectedPercentageOther" /></TD>


window.onload = main;

function main(){
function specifyProjectedPercentageOther()
      if(document.OPICForm.ProjectedPercentage5.value > 0){
            document.OPICForm.ProjectedPercentageOther.disabled = false;
      } else {
            document.OPICForm.ProjectedPercentageOther.disabled = true;
            document.OPICForm.ProjectedPercentageOther.value = "";
Question by:Gemini532
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
  • 6
  • 4
LVL 21

Expert Comment

ID: 20352460
Is hiding it an option?

when you are disabling an element by design it ignores the field completely, since it is disabled.

Author Comment

ID: 20352530
how would I hide it?
can you help me with the code?

Author Comment

ID: 20352532
can I just changed disabled to readonly?
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

LVL 21

Expert Comment

ID: 20352581
this is for readonly, you can try and see if it works. = 'none';

This is to hide it.

Author Comment

ID: 20352885
Hello nizsmo:

I followed your sugestion and wrote this code:


The taborder works, but the OTHER button is not readonly, meaning I can enter data in it even whne it is in its read only state... This is incorrect... Does read only work differently than disabled?

LVL 21

Accepted Solution

nizsmo earned 500 total points
ID: 20352921
No, read only should not let you type anything in:

but I may have misspelt (or mis-cased) the readOnly, try this:

Author Comment

ID: 20358691
Hi nizsmo,
I agree that there is something wrong in the JavaScript code, but he link  you sent me is for HTML
and the code you send me does not work:


There must be another way to code using readonly


Author Comment

ID: 20359180
I reserached and it turns out you're right, readOnly is case sensitive and NOW I can write the the columns and before I coudl NOT but the tabbing problem still remains...and that was the problem in the first place, I could have kept the code disabled if it wasn't for the need of the application to automtically tab from the checkbox OTHER to the TextBOX next to it...

like this
___              _______________________________________
|___|  Other: |______________________________________|

So when they tab using the tab key, it shoudl go from the checkbox to the textbox which is NOW enabled because when they tab the checkbox it automatically makes the textbox enabled though the code above: document.OPICForm.ProjectedPercentageOther.readOnly=true;

HOWEVER, the problem is that instead of doing it that way, the tab moves to the next checkbox

I myself have entered the tabindex as you can see in the code below, but still it skips the textbox, can you help me find out how to fix this?

 <input type="text"  tabindex=23 class="percentage" name="ProjectedPercentage5" id="ProjectedPercentage5"  onBlur="this.value=formatCurrency(this.value); projPercentage5(); specifyProjectedPercentageOther();" />&nbsp;<strong>%</strong>
 </td><TD class="responseinside"> Other: &nbsp;<input tabindex=24   name="ProjectedPercentageOther" id="ProjectedPercentageOther" />


Author Comment

ID: 20365767
Youre right I'm adding a new question on top of the one you already answered, that's not the righ way of doign things
Thank U for you help
readOnly worked!
LVL 21

Expert Comment

ID: 20369967
Glad to help Germini532, please post another question (if you have not already) should you need assistance :)

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

695 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