You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by victor sosa <vi...@gmail.com> on 2007/11/20 13:59:00 UTC
javascript update tag value property
Hi, I am trying to update a textfield when the select is changed using
javascript event onchange, so How I can do that? Which is the best practices
here?
Here is my code, any Ideas?
<script type="text/javascript">
function getVolumenInicial() {
var volumenInicial = document.getElementById('save_volumenInicial');
var maquinaSelected = document.getElementById('save_maquina_codigo');
volumenInicial.value = '%{maquinas[' + maquinaSelected.selectedIndex +
'].metro}';
}
</script>
.....
<s:select label="MÃÂáquina" name="maquina.codigo" list="maquinas"
onchange="getVolumenInicial();"
value="%{maquina.codigo}" required="true" listKey="codigo"
listValue="codigo" />
<s:textfield label="Volumen Inicial" name="volumenInicial"
value="%{venta.volumenInicial}" readonly="true" size="7" maxlength="9" />
--
View this message in context: http://www.nabble.com/javascript-update-tag-value-property-tf4843331.html#a13856511
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: javascript update tag value property [OFFTOPIC?]
Posted by victor sosa <vi...@gmail.com>.
Thks for you answer but is still open
Because I need to put into the textfield base in another property of Maquina
object (here only put id), for example: name or comment, features, ect.
So every time a select a Maquina object, I need to get also the properties
of its.
Domingo A. Rodriguez S. wrote:
>
> Hello Victor,
>
> Simplify. something like this should work.
>
> Maquina.onChange event
> {
> document.form1.textfield1.value=
> document.form1.Maquina.options[document.form1.Maquina.selectedIndex].value;
> }
>
> Regards,
> Domingo
>
> --- victor sosa <vi...@gmail.com> escribió:
>
>>
>> ANY IDEAS, how to?
>>
>>
>> victor sosa wrote:
>> >
>> > Hi, I am trying to update a textfield when the select is changed using
>> > javascript event onchange, so How I can do that? Which is the best
>> > practices here?
>> >
>> >
>> > Here is my code, any Ideas?
>> >
>> > <script type="text/javascript">
>> > function getVolumenInicial() {
>> > var volumenInicial =
>> document.getElementById('save_volumenInicial');
>> > var maquinaSelected =
>> document.getElementById('save_maquina_codigo');
>> > volumenInicial.value = '%{maquinas[' +
>> maquinaSelected.selectedIndex +
>> > '].metro}';
>> > }
>> > </script>
>> > .....
>> > <s:select label="Maquina" name="maquina.codigo" list="maquinas"
>> > onchange="getVolumenInicial();"
>> > value="%{maquina.codigo}" required="true" listKey="codigo"
>> > listValue="codigo" />
>> >
>> > <s:textfield label="Volumen Inicial" name="volumenInicial"
>> > value="%{venta.volumenInicial}" readonly="true" size="7"
>> maxlength="9"
>> > />
>> >
>> > ANY IDEAS, how to?
>> >
>> >
>>
>> --
>> View this message in context:
>>
> http://www.nabble.com/javascript-update-tag-value-property-tf4843331.html#a13858354
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> Comparte video en la ventana de tus mensajes (y también tus fotos de
> Flickr). Usa el nuevo Yahoo! Messenger versión Beta.
> http://e1.beta.messenger.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/javascript-update-tag-value-property-tf4843331.html#a13887504
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: javascript update tag value property [OFFTOPIC?]
Posted by "Domingo A. Rodriguez S." <do...@yahoo.com>.
Hello Victor,
Simplify. something like this should work.
Maquina.onChange event
{
document.form1.textfield1.value=
document.form1.Maquina.options[document.form1.Maquina.selectedIndex].value;
}
Regards,
Domingo
--- victor sosa <vi...@gmail.com> escribió:
>
> ANY IDEAS, how to?
>
>
> victor sosa wrote:
> >
> > Hi, I am trying to update a textfield when the select is changed using
> > javascript event onchange, so How I can do that? Which is the best
> > practices here?
> >
> >
> > Here is my code, any Ideas?
> >
> > <script type="text/javascript">
> > function getVolumenInicial() {
> > var volumenInicial =
> document.getElementById('save_volumenInicial');
> > var maquinaSelected =
> document.getElementById('save_maquina_codigo');
> > volumenInicial.value = '%{maquinas[' +
> maquinaSelected.selectedIndex +
> > '].metro}';
> > }
> > </script>
> > .....
> > <s:select label="Maquina" name="maquina.codigo" list="maquinas"
> > onchange="getVolumenInicial();"
> > value="%{maquina.codigo}" required="true" listKey="codigo"
> > listValue="codigo" />
> >
> > <s:textfield label="Volumen Inicial" name="volumenInicial"
> > value="%{venta.volumenInicial}" readonly="true" size="7"
> maxlength="9"
> > />
> >
> > ANY IDEAS, how to?
> >
> >
>
> --
> View this message in context:
>
http://www.nabble.com/javascript-update-tag-value-property-tf4843331.html#a13858354
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Comparte video en la ventana de tus mensajes (y también tus fotos de Flickr). Usa el nuevo Yahoo! Messenger versión Beta.
http://e1.beta.messenger.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: javascript update tag value property
Posted by victor sosa <vi...@gmail.com>.
ANY IDEAS, how to?
victor sosa wrote:
>
> Hi, I am trying to update a textfield when the select is changed using
> javascript event onchange, so How I can do that? Which is the best
> practices here?
>
>
> Here is my code, any Ideas?
>
> <script type="text/javascript">
> function getVolumenInicial() {
> var volumenInicial = document.getElementById('save_volumenInicial');
> var maquinaSelected = document.getElementById('save_maquina_codigo');
> volumenInicial.value = '%{maquinas[' + maquinaSelected.selectedIndex +
> '].metro}';
> }
> </script>
> .....
> <s:select label="Maquina" name="maquina.codigo" list="maquinas"
> onchange="getVolumenInicial();"
> value="%{maquina.codigo}" required="true" listKey="codigo"
> listValue="codigo" />
>
> <s:textfield label="Volumen Inicial" name="volumenInicial"
> value="%{venta.volumenInicial}" readonly="true" size="7" maxlength="9"
> />
>
> ANY IDEAS, how to?
>
>
--
View this message in context: http://www.nabble.com/javascript-update-tag-value-property-tf4843331.html#a13858354
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org