How to trigger Radio-Button click

This section is for posting questions which are not directly related to WYSIWYG Web Builder.
Examples of off topics: web server configuration, hosting, programming related questions, third party scripts.

Note that these questions will generally not be answered by the administrators of this forum.
Post Reply
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

How to trigger Radio-Button click

Post 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
User avatar
Pablo
 
Posts: 21575
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: How to trigger Radio-Button click

Post 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.
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: How to trigger Radio-Button click

Post 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
User avatar
Pablo
 
Posts: 21575
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: How to trigger Radio-Button click

Post 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
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: How to trigger Radio-Button click

Post 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
User avatar
Pablo
 
Posts: 21575
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: How to trigger Radio-Button click

Post 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.
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: How to trigger Radio-Button click

Post 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
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: How to trigger Radio-Button click

Post by alex4orly »

Well, I removed the validation completely and re-published the page "All files" but that code was NOT removed
Why?
maxime
 
 
Posts: 117
Joined: Sat Apr 02, 2011 6:15 pm
Contact:

Re: How to trigger Radio-Button click

Post 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.
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: How to trigger Radio-Button click

Post 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
User avatar
Pablo
 
Posts: 21575
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: How to trigger Radio-Button click

Post 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.
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: How to trigger Radio-Button click

Post by alex4orly »

I emailed you the project file, no doubt it is something wrong I am doing

Thanks for your help
User avatar
Pablo
 
Posts: 21575
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: How to trigger Radio-Button click

Post by Pablo »

Image
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: How to trigger Radio-Button click

Post by alex4orly »

OK, I see - but I completely removed the Validation, so why is the code still in the file?

Thanks again
User avatar
Pablo
 
Posts: 21575
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: How to trigger Radio-Button click

Post by Pablo »

Because the value is still set to '0'. Please empty the input field.
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: How to trigger Radio-Button click

Post by alex4orly »

Now I understand

Thanks
Post Reply