tdenny
asked on
Disable a text box
Hello experts,
I'm working on a page where I have a text box that I want to display something only. I have a link that allows the user to select an employee (LDAP query) in a popup window. Once selected the current application populates the text box on the parent form with the name they selected. So I've been able to automate the process but I want to be sure the user doesn't then overtype a name that might not exist in the LDAP. My thinking is that the simplest approach would be to somehow disable the text box for data entry.
I know you can disable the text box in IE but I have to make this work in Netscape (4.7) as well. The display for the text box is populated by some Javascript. The user must choose something. Any suggestions. Thanks
TD
I'm working on a page where I have a text box that I want to display something only. I have a link that allows the user to select an employee (LDAP query) in a popup window. Once selected the current application populates the text box on the parent form with the name they selected. So I've been able to automate the process but I want to be sure the user doesn't then overtype a name that might not exist in the LDAP. My thinking is that the simplest approach would be to somehow disable the text box for data entry.
I know you can disable the text box in IE but I have to make this work in Netscape (4.7) as well. The display for the text box is populated by some Javascript. The user must choose something. Any suggestions. Thanks
TD
ASKER
Winning,
A good point but the javascript that I am currently using to populate the textbox on the parent form will only work to populate a text box.
A good point but the javascript that I am currently using to populate the textbox on the parent form will only work to populate a text box.
ASKER
Winning,
A good point but the javascript that I am currently using to populate the textbox on the parent form will only work to populate a text box.
A good point but the javascript that I am currently using to populate the textbox on the parent form will only work to populate a text box.
ASKER
Winning,
I wasn't aware of a "label" control in HTML. I know in access you can create a text box or a label and that the label can be populated with any number of possibilities but I didn't know you could do something like this in HTML
I wasn't aware of a "label" control in HTML. I know in access you can create a text box or a label and that the label can be populated with any number of possibilities but I didn't know you could do something like this in HTML
There is an article with some possible solutions to your problem at
http://tech.irt.org/articles/js131/index.htm
It explores several possibilities for disabling form elements.
Michael
http://tech.irt.org/articles/js131/index.htm
It explores several possibilities for disabling form elements.
Michael
Ooops, forgot one,
There is also an example at
http://www.devguru.com/features/knowledge_base/A100212_form.asp
This is supposed to work in NN4.x, but I have not tested it.
Michael
There is also an example at
http://www.devguru.com/features/knowledge_base/A100212_form.asp
This is supposed to work in NN4.x, but I have not tested it.
Michael
ASKER
SewellM,
I'm testing to see if I can get one of your suggested links to work in Netscape without losing any of my other functionality. Thanks for the response.
I'm testing to see if I can get one of your suggested links to work in Netscape without losing any of my other functionality. Thanks for the response.
A really simple way is to not allow them to focus on the text box using a bit of javascript. Heres a short example:
<script language="javascript">
function GetLDAPUser() {
/* Put your window opening codehere */
}
</script>
<form name="form1" action="whatever.cfm" method="post">
<input type="text" name="LDAP_User" onfocus="document.form1.bt nSelectUse r.focus(); " style="....">
<input type="button" name="btnSelectUser" onclick="GetLDAPUser()">
....
</form>
Hope this helps,
:) dapperry
<script language="javascript">
function GetLDAPUser() {
/* Put your window opening codehere */
}
</script>
<form name="form1" action="whatever.cfm" method="post">
<input type="text" name="LDAP_User" onfocus="document.form1.bt
<input type="button" name="btnSelectUser" onclick="GetLDAPUser()">
....
</form>
Hope this helps,
:) dapperry
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
lpkuah, daperry,
I really liked both of your answers. Both tested and both will work. Not sure how to split up the points or if I can even do that. Thanks very much for those very clever solutions!!!
I really liked both of your answers. Both tested and both will work. Not sure how to split up the points or if I can even do that. Thanks very much for those very clever solutions!!!
winningl