Page 1 of 1

Radio button not working

Posted: Wed Oct 28, 2020 11:31 am
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

Re: Radio button not working

Posted: Wed Oct 28, 2020 6:25 pm
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.

Re: Radio button not working

Posted: Wed Oct 28, 2020 7:52 pm
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

Re: Radio button not working

Posted: Wed Oct 28, 2020 8:41 pm
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).

Re: Radio button not working

Posted: Wed Oct 28, 2020 9:00 pm
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

Re: Radio button not working

Posted: Thu Oct 29, 2020 7:02 am
by Pablo
The title specifies the tooltip.

Re: Radio button not working

Posted: Thu Oct 29, 2020 7:26 am
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

Re: Radio button not working

Posted: Thu Oct 29, 2020 4:52 pm
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.

Re: Radio button not working

Posted: Thu Oct 29, 2020 7:34 pm
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

Re: Radio button not working

Posted: Thu Oct 29, 2020 8:48 pm
by Pablo
I was referring to the 'Label' object. You can find this in the toolbox.

Re: Radio button not working

Posted: Thu Oct 29, 2020 9:06 pm
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

Re: Radio button not working

Posted: Fri Oct 30, 2020 7:02 am
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.

Re: Radio button not working

Posted: Fri Oct 30, 2020 7:39 am
by alex4orly
That's a nice feature

Thanks