B4J Question WebSocket Get Radio Button status

Discussion in 'B4J Questions' started by aaronk, Jun 19, 2015.

  1. aaronk

    aaronk Well-Known Member Licensed 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:

    Code:
    '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 ?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Try:
    Code:
    true1.GetProp("checked")
     
  3. aaronk

    aaronk Well-Known Member Licensed User

  4. Erel

    Erel Administrator Staff Member Licensed User

    Is true1 selected?
     
  5. aaronk

    aaronk Well-Known Member Licensed User

  6. aaronk

    aaronk Well-Known Member Licensed 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:

    Code:
    Private test1 As JQueryElement
    Then the code below worked.

    Code:
    test1.GetProp("checked")
    Thanks heaps for your help.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice