B4J Question WebSocket Get Radio Button status

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I am using a WebSocket in my B4J project, and I can get the text that is entered into a textbox fine, but I am trying to work out what radio button has been selected in the webpage.

Here is my HTML code:

HTML:
<div class="clip-radio radio-primary">
    <input type="radio" id="test1" name="demo" value="yes">
    <label for="test1">
        Yes
    </label>
    <input type="radio" id="test2" name="demo" value="no">
    <label for="test2">
        No
    </label>
</div>

When I use:

B4X:
'WebSocket class
Sub Class_Globals
    Private true1 As JQueryElement
End Sub

Sub SaveSettings_Click (Params As Map)
    Dim test1_value As Future = true1.GetVal
    Log("test1_value.Value) = " & test1_value.Value)
End Sub

It seems to log the radio button value such as 'yes'.
Is there a way to get True or False if the radio button has been selected ?

So if the user selects the 'Yes' radio button to return 'True' where if the radio button isn't selected to return 'False'

Any one know how to do this ?
 

aaronk

Well-Known Member
Licensed User
Longtime User
Whops.. My mistake.

You will notice that my Code in Sub_Globals doesn't match up with my HTML code.
I needed to change my Sub_Globals code to:

B4X:
Private test1 As JQueryElement

Then the code below worked.

B4X:
test1.GetProp("checked")

Thanks heaps for your help.
 
Upvote 0
Top