Radio button not working

Issues related to forms.
Post Reply
alex4orly
Posts: 132
Joined: Thu Jul 23, 2020 9:34 am

Radio button not working

Post by alex4orly »

I tried using the switcher object, but no go.

So, I am trying now to use Radio buttons, at first - the following Onclick function
function LocationStart(buttonid)
{
var bid = buttonid;

if(bid.name == "My Location")
{
document.getElementById("RadioButton1").checked = false;
document.getElementById("RadioButton2").checked = true;
}
else
{
document.getElementById("RadioButton1").checked = false;
document.getElementById("RadioButton2").checked = true;
}
}
Have a look here : https://ourvilla.net.au/page12.html

The one on the left is RadioButton1 which is enabled at first.

I want to have it so that if the user clicks on Button2, it will switch OFF / Clear Button1 (which it does) and Check ON Button2 - which it does not, why?

In the WB system, I was able to group the two buttons, so that if one is turned off, the other comes ON

How do I do it here?

Thanks
User avatar
Pablo
Site Admin
Posts: 3291
Joined: Mon Feb 13, 2006 7:00 am
Location: Europe
Contact:

Re: Radio button not working

Post by Pablo »

I'm sorry, but I cannot help you with custom script.

However, the radio buttons should have name to be part of the same group. This works the same as in WWB, because it's standard HTML functionality.
alex4orly
Posts: 132
Joined: Thu Jul 23, 2020 9:34 am

Re: Radio button not working

Post by alex4orly »

My first preference would be to do it in QEB without any custom code
Please tell me how? So, I will give each a name - then what?

I gave them both names, checked both, clicked on Group - but it doesn't switch the first OFF when I click the 2nd
What am I missing?

Thanks
User avatar
Pablo
Site Admin
Posts: 3291
Joined: Mon Feb 13, 2006 7:00 am
Location: Europe
Contact:

Re: Radio button not working

Post by Pablo »

Both radio buttons should have the same value in the 'Name' property. This works the same as in WWB (and any other web design tool).
alex4orly
Posts: 132
Joined: Thu Jul 23, 2020 9:34 am

Re: Radio button not working

Post by alex4orly »

OK, that works : https://ourvilla.net.au/page13.html

But, I gave each a Title - it doesn't show the text next to the button

Why?

Thanks
User avatar
Pablo
Site Admin
Posts: 3291
Joined: Mon Feb 13, 2006 7:00 am
Location: Europe
Contact:

Re: Radio button not working

Post by Pablo »

The title specifies the tooltip.
alex4orly
Posts: 132
Joined: Thu Jul 23, 2020 9:34 am

Re: Radio button not working

Post by alex4orly »

Yes, I noticed that
So, there is no way to include a visible text next to the button?
If yes, how?

It will be best if I don't need to add another column in the Layout Grid, it looks wrong on mobile phone

Thanks
User avatar
Pablo
Site Admin
Posts: 3291
Joined: Mon Feb 13, 2006 7:00 am
Location: Europe
Contact:

Re: Radio button not working

Post by Pablo »

To add text you can use a label.
Set the 'full width' property of the label to false to place it on the same row.
alex4orly
Posts: 132
Joined: Thu Jul 23, 2020 9:34 am

Re: Radio button not working

Post by alex4orly »

We are talking about Radio button
I don't see a property called Label - where?
Nor an option to turn OFF full width

Thanks
User avatar
Pablo
Site Admin
Posts: 3291
Joined: Mon Feb 13, 2006 7:00 am
Location: Europe
Contact:

Re: Radio button not working

Post by Pablo »

I was referring to the 'Label' object. You can find this in the toolbox.
alex4orly
Posts: 132
Joined: Thu Jul 23, 2020 9:34 am

Re: Radio button not working

Post by alex4orly »

OK, I was thinking about a property of the Radio button
Works OK, all good

One last question - do I have to GROUP the label and the Radio Button to make sure they stey together on a mobile phone?

Thanks
User avatar
Pablo
Site Admin
Posts: 3291
Joined: Mon Feb 13, 2006 7:00 am
Location: Europe
Contact:

Re: Radio button not working

Post by Pablo »

do I have to GROUP the label and the Radio Button to make sure they stey together on a mobile phone?
'group' is a design feature, it does not affect the output.

However, the label has a 'for' property. Here you can select the radio button's ID.
Then, if you click the label, it will select the radio button.
alex4orly
Posts: 132
Joined: Thu Jul 23, 2020 9:34 am

Re: Radio button not working

Post by alex4orly »

That's a nice feature

Thanks
Post Reply