value is modified in the gui only when the Radio Input looses focus

M

MarsVoyager

Hi,
I want to change the value of a submit button when the onChange event is
fired by a Radio Input.
Problem is, it seems the value is modified in the gui only when the Radio
Input looses focus, not when its value is changed by the user.

How can I make the value on the submit button change immediately upon action
on the radio input and not when focus changes ?

Thanks...

--- bits of code : html ---

<INPUT TYPE="RADIO" NAME="CFGWEB01" onChange="comboChange('CFGWEB01')" VALUE
= "ASGes">

<input type="submit" name="submit" value="1st value">

--- js ---

document.forms[0].submit.value='Other value';
 
D

DU

MarsVoyager said:
Hi,
I want to change the value of a submit button when the onChange event is
fired by a Radio Input.
Problem is, it seems the value is modified in the gui only when the Radio
Input looses focus, not when its value is changed by the user.

How can I make the value on the submit button change immediately upon action
on the radio input and not when focus changes ?

Thanks...

--- bits of code : html ---

<INPUT TYPE="RADIO" NAME="CFGWEB01" onChange="comboChange('CFGWEB01')" VALUE
= "ASGes">

IIRC, onchange is not supported for radio button; onclick is though for
radio buttons.
<input type="submit" name="submit" value="1st value">

--- js ---

document.forms[0].submit.value='Other value';

DU
 
R

RobG

DU wrote:
[...]
IIRC, onchange is not supported for radio button; onclick is though for
radio buttons.

As far as I can see, onchange is supported for all input
controls, including radio buttons. However, the spec also says
that the onchange does not fire until the control loses focus and
has been changed. So clicking on the radio button does nothing
until you click somewhere else to cause the control to lose focus.

IE implements this to the letter, which means that if you click on
one control, then another, the onclick of the first fires when you
click on the second and the second when you click somewhere else
(back on the first maybe?).

Firefox, on the other hand, fires the onchange when the control is
clicked, which is more intuitive but not what the spec says.

*onchange*
<URL:http://www.w3.org/TR/html4/interact/scripts.html#adef-onchange>

*radio button*
<URL:http://www.w3.org/TR/html4/interact/forms.html#radio>

Hence, onclick is often used instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top