aaronk Well-Known Member Licensed User Longtime User Jun 19, 2015 #1 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: Copy <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: Code: Copy '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 ?
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: Copy <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: Code: Copy '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 ?
Erel B4X founder Staff member Licensed User Longtime User Jun 19, 2015 #2 Try: Code: Copy true1.GetProp("checked") Upvote 0
aaronk Well-Known Member Licensed User Longtime User Jun 19, 2015 #3 Erel said: Try: Code: Copy true1.GetProp("checked") Click to expand... Didn't work.. It returned: anywheresoftware.b4j.object.WebSocket$SimpleFuture@2a74c252 If I then use: Code: Copy true1.GetProp("checked").Value it returns null Upvote 0
Erel said: Try: Code: Copy true1.GetProp("checked") Click to expand... Didn't work.. It returned: anywheresoftware.b4j.object.WebSocket$SimpleFuture@2a74c252 If I then use: Code: Copy true1.GetProp("checked").Value it returns null
Erel B4X founder Staff member Licensed User Longtime User Jun 19, 2015 #4 Is true1 selected? Upvote 0
aaronk Well-Known Member Licensed User Longtime User Jun 19, 2015 #6 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: Code: Copy Private test1 As JQueryElement Then the code below worked. Code: Copy test1.GetProp("checked") Thanks heaps for your help. Upvote 0
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: Code: Copy Private test1 As JQueryElement Then the code below worked. Code: Copy test1.GetProp("checked") Thanks heaps for your help.