Page 1 of 1

How to trigger Radio-Button click

Posted: Sat Apr 01, 2017 12:33 am
by alex4orly
I have a page with several radio buttons.
I want to trigger a check / click event and through this, to populate an input field on a form
I tried both onclick and onchange but the function doesn't get called
Tried various online searches without any luck

Any suggestions?

http://www.nmaa-rc.org.au/ : top right - Members Login : 61178 / 12345
The default button is checked on $208.00 and the input field is pre-set to the same amount.

I want that if the user clicks any other button, it will call my function who will set the new value into that input field

Cheers

Re: How to trigger Radio-Button click

Posted: Sat Apr 01, 2017 7:33 am
by Pablo
The code does not work because there are other errors on the page (in your validation, see your other post).
You will need to fix this first, otherwise the browser will not call your code.

I think it is useful if you learn how to use the browser's debugger (F12) then you can see exactly what is happening in case something goes wrong.

Re: How to trigger Radio-Button click

Posted: Sun Apr 02, 2017 6:48 am
by alex4orly
Pablo,
I am a retired C++ programmer, debugging is natural to me and I would love to be able to step through the code.
But I tried searching how to do that with IE-11 and can only find explanations of older IE versions, will appreciate it if you could point me to a good article if you know one.

I have in the meantime resolved the radio buttons query

Thank you

Re: How to trigger Radio-Button click

Posted: Sun Apr 02, 2017 7:16 am
by Pablo
I am also a c++ programmer;)

I do not know about any good article for the IE debugger, but if you are familiar with MS Visual Studio or another development environment then I think it speaks for itself.
- Press F12 to launch the debugger
- Select the 'Debugger' tab
- now you can set breakpoints in the Java script code.
- if there are problems in the script then the errors will be displayed in the 'Console' tab

Re: How to trigger Radio-Button click

Posted: Sun Apr 02, 2017 8:28 pm
by alex4orly
OK, I figured it out, when I look at the code generated - I see the following:

if (theForm.Editbox8.value != "" && !(theForm.Editbox8.value > 0 && theForm.Editbox8.value <= ))
{
alert("Must enter amount paid BEFORE submitting");
theForm.Editbox8.focus();
return false;
}

Of course, the <= is missing a value, but I didn't enter this code it is generated by WWB, so what am I doing wrong to cause it to generate an incomplete statement?

Cheers

Re: How to trigger Radio-Button click

Posted: Sun Apr 02, 2017 8:37 pm
by Pablo
You have set a minimum value but not a max value.
You will need to set both values. See also my reply in your other post.

Re: How to trigger Radio-Button click

Posted: Sun Apr 02, 2017 9:44 pm
by alex4orly
Sorry Pablo,

Minimum is set to 2 and Maximum is set to 10, but it still comes up wrong

Maybe I should remove validation and then re-enter it again?

Thanks again for your help

Re: How to trigger Radio-Button click

Posted: Sun Apr 02, 2017 9:48 pm
by alex4orly
Well, I removed the validation completely and re-published the page "All files" but that code was NOT removed
Why?

Re: How to trigger Radio-Button click

Posted: Sun Apr 02, 2017 11:07 pm
by maxime
I want that if the user clicks any other button, it will call my function who will set the new value into that input field
I have just try an it is working the amount is changing when you click.

Re: How to trigger Radio-Button click

Posted: Sun Apr 02, 2017 11:22 pm
by alex4orly
Yes Maxime,
If you look up the page here you will see that I fixed it and that works fine
The problem is the input field validation is not working

Thanks for your help as always

Re: How to trigger Radio-Button click

Posted: Mon Apr 03, 2017 6:00 am
by Pablo
I need to see your project file to be able to help you, but I'm sure this is a mistake in your settings.

Re: How to trigger Radio-Button click

Posted: Mon Apr 03, 2017 6:58 am
by alex4orly
I emailed you the project file, no doubt it is something wrong I am doing

Thanks for your help

Re: How to trigger Radio-Button click

Posted: Mon Apr 03, 2017 7:27 am
by Pablo
Image

Re: How to trigger Radio-Button click

Posted: Mon Apr 03, 2017 8:10 am
by alex4orly
OK, I see - but I completely removed the Validation, so why is the code still in the file?

Thanks again

Re: How to trigger Radio-Button click

Posted: Mon Apr 03, 2017 8:54 am
by Pablo
Because the value is still set to '0'. Please empty the input field.

Re: How to trigger Radio-Button click

Posted: Mon Apr 03, 2017 9:12 am
by alex4orly
Now I understand

Thanks