You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Frances Aleah Z. de Guzman" <ad...@ingenium.com.ph> on 2003/06/30 23:39:55 UTC

disabling form element

can anyone tell me how to disable a form element via javascript. i have a 
combo box and i want to use the onchange event to disable a certain 
textbox...

<nested:select property="paramType" onchange="javascript:change()"> 
       <html:optionsCollection name="lookup" property="applications"/> 
</nested:select> 

the textbox is:
<nested:text property="remarks" size="50" />

the javascript:
function change(){
  document.forms[0].remarks.disabled=true;
}

is there anything wrong with my code?
-- 
Frances Aleah Z. De Guzman
SA/Programmer
Ingenium Technology, Inc.
http://www.ingenium.com.ph

Disclaimer :
This message is intended only for the named recipient. If you are not the
intended recipient you are notified that disclosing, copying, distributing
or taking any action in reliance on the contents of this information is
strictly prohibited.



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: disabling form element

Posted by Mark Lowe <ma...@talk21.com>.
//I prefer this way of drilling through the DOM.

But document.forms[0].remarks should be fine as well.

document.forms[0].elements['remarks'].disabled = true;

the onchange event doesn't require the javascript: i only use this when 
I'm calling functions from a href.

onchange="change()"


HTH mark


On Monday, Jun 30, 2003, at 22:39 Europe/London, Frances Aleah Z. de 
Guzman wrote:

> can anyone tell me how to disable a form element via javascript. i 
> have a
> combo box and i want to use the onchange event to disable a certain
> textbox...
>
> <nested:select property="paramType" onchange="javascript:change()">
>        <html:optionsCollection name="lookup" property="applications"/>
> </nested:select>
>
> the textbox is:
> <nested:text property="remarks" size="50" />
>
> the javascript:
> function change(){
>   document.forms[0].remarks.disabled=true;
> }
>
> is there anything wrong with my code?
> -- 
> Frances Aleah Z. De Guzman
> SA/Programmer
> Ingenium Technology, Inc.
> http://www.ingenium.com.ph
>
> Disclaimer :
> This message is intended only for the named recipient. If you are not 
> the
> intended recipient you are notified that disclosing, copying, 
> distributing
> or taking any action in reliance on the contents of this information is
> strictly prohibited.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org