facebook

Check box and Radio Buttons value are "Undefined"

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #349676 Reply

    roverMc
    Member

    Can anyone help me with this? I’ve tried everything that I can to get either the values from check boxes and radio buttons and they come back undefined. I even put in the Create and Email a Survey example from Mobione. I’m shooting for an IOS web app. I’m using Mobione version 2.6.2.

    #349677 Reply

    Hi roverMc,

    I suspect something is wrong with the code you are using. I just tested this and it worked:

    $('#m1-<ProjectName>-<checkboxWidgetId> > input').is(':checked'))
    #349686 Reply

    roverMc
    Member

    Thanks but now:

    This changes the response from “undefined” to “false”. It returns “false” no matter the state of the checkbox is clicked???? My project is named “Checker”, it has a check box named “checkbox1” and a text field named “textField1” along with a button that calls for javascript “CheckMe()”.

    It now contains your script that I adapted:

    function CheckMe(){

    var x1 = $(‘Checker-checkbox1 > input’).is(‘:checked’);
    document.getElementById(‘Checker-textField1’).value=(x1);
    }

    #349690 Reply

    Hi roverMc,

    Note that Mobione add a prefix to your widgets id by default: “m1-“. You can disable this in settings.
    Now, the problem you’re having seems to be that there is not a widget with id Checker-checkbox1 and that’s why it always return false, instead try with:

    var x1 = $('#m1-Checker-checkbox1 > input').is(':checked');
Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Check box and Radio Buttons value are "Undefined"

You must be logged in to post in the forum log in