473,378 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Problem with JS disabled fields

Hi,

I've a little script that disables/enables some fields in a form. It
works correctly, no problem.
Problem arise when a disabled field becomes enabled again: the enter
key pressed in that field do not trigger the form submittion, or any
other "onXXX" event. But it does not raise a JS error either... Of
course, if the same field is enabled when page loads, the enter key
works perfectely well and submits the form. So it's really the state
change that cause the problem. To make it even more strange, once the
enter key has been pressed without effect, the enter key submittion is
disabled in all other fields, even the ones which status have not been
changed!!

Precisions:
- problem shows under IE 5.5 or 6.0.
- there are no specific treatment on key press, only events are
onBlur and onFocus

Could someone help me on this ?

Sylvestre
Jul 23 '05 #1
3 2006
Ivo

"sylvestre" typed
I've a little script that disables/enables some fields in a form. It
works correctly, no problem.
Problem arise when a disabled field becomes enabled again: the enter
key pressed in that field do not trigger the form submittion, or any
other "onXXX" event. But it does not raise a JS error either... Of
course, if the same field is enabled when page loads, the enter key
works perfectely well and submits the form. So it's really the state
change that cause the problem. To make it even more strange, once the
enter key has been pressed without effect, the enter key submittion is
disabled in all other fields, even the ones which status have not been
changed!!

Precisions:
- problem shows under IE 5.5 or 6.0.
- there are no specific treatment on key press, only events are
onBlur and onFocus


Strange indeed. But these precisions leave me clueless. Can we some some
actual code or an url?
Ivo
Jul 23 '05 #2
> Strange indeed. But these precisions leave me clueless. Can we some some
actual code or an url?


No url, it's internal application, but here is some code:

* the activate/desactivate function:

function stpAct(intStp,intGrp,blnAct)
{
var intCnt;
var tabObj;

/* assign the step table */
tabObj = tabObjStp[intStp];
/* (des)activate object */
for (intCnt=0;intCnt<tabObj.length;intCnt++)
{
if (tabObj[intCnt][1] == intGrp)
{
objTmp = document.getElementById(tabObj[intCnt][0]);
if (objTmp)
{
if (blnAct)
{
objTmp.disabled = false;
objTmp.className = objTmp.alt;
}
else
{
objTmp.disabled = true;
objTmp.value = '';
objTmp.className = 'frmDis';
}
}
}
}
}

* one of the fields definition::

<input tabindex="3" onBlur="stpVal(3)" onFocus="stpSelFld(3)"
name="txtPrfBctId" type="text" size="3" maxlength="2" value=""
class="frmDis" alt="frmOpt" disabled>

Once the "txtPrfBctId" field get activated by stpAct() function, it
causes the form submittion on enter is disabled!
Jul 23 '05 #3
Ivo
"sylvestre" wrote
* the activate/desactivate function:

function stpAct(intStp,intGrp,blnAct)
{
var intCnt;
var tabObj;

/* assign the step table */
tabObj = tabObjStp[intStp];
/* (des)activate object */
for (intCnt=0;intCnt<tabObj.length;intCnt++)
{
if (tabObj[intCnt][1] == intGrp)
{
objTmp = document.getElementById(tabObj[intCnt][0]);
Add "var " in front of the above line to keep objTmp a local variable.
if (objTmp)
{
if (blnAct)
{
objTmp.disabled = false;
objTmp.className = objTmp.alt;
?
}
else
{
objTmp.disabled = true;
objTmp.value = '';
objTmp.className = 'frmDis';
}
}
}
}
}

* one of the fields definition::

<input tabindex="3" onBlur="stpVal(3)" onFocus="stpSelFld(3)"
name="txtPrfBctId" type="text" size="3" maxlength="2" value=""
class="frmDis" alt="frmOpt" disabled>

Once the "txtPrfBctId" field get activated by stpAct() function, it
causes the form submittion on enter is disabled!


I can't immediately point out the erronous semicolon. Just make general
suggestion to add some debug alerts at various spots to trace the flow of
running code (also in function stpVal as hitting enter may or may not invoke
the onblur event), use alt attributes in images, not in input elements. What
global variable is tabObjStp? Looks like a deep heavy nasty multinested
array, are you sure it contains expected values? How stpAct() is called,
with what arguments, is also of interest of course.
Perhaps put up a public testpage.
Ivo
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Patrick L. Nolan | last post by:
Our Tkinter application has a big ScrolledText widget which is a log of everything that happens. In order to prevent people from making changes, we have it in DISABLED mode except when the...
0
by: Srinivas | last post by:
Hi, I've one system in which Active directory is installed. That system is the domain controller as well as web server - A test machine. Trying all following to Authenticate Users using VB as...
5
by: bart plessers | last post by:
Hello, Somewhere in my code I have <input TYPE="button" NAME="btnFirst" VALUE="<<" OnClick="GetFile('1')" DISABLED> I changed the layout of the INPUT with a stylesheet to INPUT { color:...
1
by: Ittay Dror | last post by:
Hi, I have a form with various elements which, according to changes in values become enabled or disabled. The disabled elements are normally not submitted, but I wish they were. How can I go...
7
by: George | last post by:
Hi all, I have the following code to use checkboxes on my page: if instr(Request.form("chkWorkType"),"03") then response.write("<td width=""23%"" class=""detaillp""><input type=""checkbox""...
3
by: Kelly Domalik | last post by:
I would like to override the "disabled" property of a hidden field. When disabled is set to "true", it would call a function to disable 2 other text fields on the form. When disabled is set to...
3
by: Bubba Gump | last post by:
I hope someone can help here. I'm creating a form that disables certain fields depending on the users choices. But I've noticed that Disabled fields aren't "grayed out" (ie: you can't tell they're...
1
by: jediknight | last post by:
I am having some problems getting the correct values from a textbox in a gridview. When I create the gridview my textboxes are initialised to zeros but the user can then updates some of these....
1
by: mikaint | last post by:
I've read that if a field is set to disabled, it will be excluded from the submited fields when sending a form. Is there an alternative way to disable a field but still, send it with the form? I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.