You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Søren Blidorf <so...@nolas.dk> on 2006/11/19 15:24:49 UTC
javascript and readonly in struts
Hi.
I am trying to convert the following in to struts taglib
<script language="javascript">
function choose() {
if (this.form.v1.selectedIndex==3) {
this.form.v2.readOnly=true;
this.form.v2.value='';
}
}
</script>
<select name="v1" onchange="choose(selectedIndex)">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<input type="text" name="v2">
How do I make this work:
<script language="javascript">
function choose() {
if (this.form.v1.selectedIndex==3) {
this.form.v2.readOnly=true;
this.form.v2.value='';
}
}
</script>
<html:select property="v1" onchange="choose(selectedIndex)">
<html:option value="1">1</html:option>
<html:option value="2">2</html:option>
<html:option value="3">3</html:option>
</html:select>
<html:text property="v2">
Søren Blidorf
Nolas Consulting
Automatikvej 1
DK-2860 Søborg
Telefon: +45 32713661
Direkte: +45 61676513
Webside: www.nolas.dk
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: javascript and readonly in struts
Posted by Laurie Harper <la...@holoweb.net>.
Søren Blidorf wrote:
> Hi.
>
> I am trying to convert the following in to struts taglib
I'm not really sure what that means. You want to convert a client-side
Javascript behaviour to a server-side behaviour. What is the use case
you're trying to achieve?
> <script language="javascript">
> function choose() {
>
> if (this.form.v1.selectedIndex==3) {
> this.form.v2.readOnly=true;
> this.form.v2.value='';
> }
> }
> </script>
>
> <select name="v1" onchange="choose(selectedIndex)">
> <option value="1">1</option>
> <option value="2">2</option>
> <option value="3">3</option>
> </select>
OK, so when the selected value is changed, you have Javascript that will
dynamically set another field to readonly. Are you asking how to
implement the same logic if the form is submitted with the appropriate
option selected?
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: javascript and readonly in struts
Posted by Martin Gainty <mg...@hotmail.com>.
Soren--
you may want to use the disabled attribute as in
form.v2.disabled=true;
works for me ..(I do not know if the form.v2.readonly is operational)
also in the body of the code if your control is not passing any parameters use onChange="choose();"
Tak,
Martin --
This e-mail communication and any attachments may contain confidential and privileged information for the use of the
designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received
this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its
contents
----- Original Message -----
From: "Søren Blidorf" <so...@nolas.dk>
To: <us...@struts.apache.org>
Sent: Sunday, November 19, 2006 9:24 AM
Subject: javascript and readonly in struts
Hi.
I am trying to convert the following in to struts taglib
<script language="javascript">
function choose() {
if (this.form.v1.selectedIndex==3) {
this.form.v2.readOnly=true;
this.form.v2.value='';
}
}
</script>
<select name="v1" onchange="choose(selectedIndex)">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<input type="text" name="v2">
How do I make this work:
<script language="javascript">
function choose() {
if (this.form.v1.selectedIndex==3) {
this.form.v2.readOnly=true;
this.form.v2.value='';
}
}
</script>
<html:select property="v1" onchange="choose(selectedIndex)">
<html:option value="1">1</html:option>
<html:option value="2">2</html:option>
<html:option value="3">3</html:option>
</html:select>
<html:text property="v2">
Søren Blidorf
Nolas Consulting
Automatikvej 1
DK-2860 Søborg
Telefon: +45 32713661
Direkte: +45 61676513
Webside: www.nolas.dk
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org