• Cindy Chastang
    July 13, 2016 at 12:13 pm #2313

    I have a checkbox control on a client side human service.   I have created a function in a customHTML to do a validation to ensure the end user checks the box.

    The code looks like this:

    var checkBox = page.ui.get(“confirmCheckbox”);
    checkBox.setValid(checkBox.isChecked() == true,”Please confirm that all activities have been completed accurately” );
    if (checkBox.isValid() == false) { console.log(“checkbox error”);}

    When I run it without checking the box I can see isChecked = false   but isValid = true  (expected to see isValid = false )

    When I check the box I see isChecked = true and isValid = true (as expected)

    It looks like setValid does not work with a checkbox.   I just wanted to confirm if this is true – or if there is something incorrect in my code.

    SPARK Support
    July 14, 2016 at 8:36 am #2315

    Hi Cindy,

    I have replicated your code on one of our Test Servers, and everything in your code is correct.  However, there appears to be a bug in the .setValid() method of the CheckBox control.  The issue has been logged and will be fixed in an upcoming version.  Thank you for reporting this to us.


    Stephen P.

    SPARK Support
    July 14, 2016 at 3:29 pm #2318

    Hi Cindy,

    As a work around, you might try using a Custom HTML Control to hold a validation function, and call this from the On Click event of the Submit button on the page.  If the Checkbox is checked, then return true, otherwise return nothing and display an Output Text Control message.


    Stephen P.

    Cindy Chastang
    July 15, 2016 at 5:57 am #2321

    Thank you Stephen – good to know it will get fixed in a future release.

    We opted to add text to the Modal Alert that appears.    We check a number of fields in a validation function in the Custom HTML then show a Modal with some instructions if any of them fail.

    Melissa Massey
    May 23, 2017 at 10:33 am #4340

    Is this still a known issue?  I am on version EE.

    SPARK Support
    May 30, 2017 at 1:49 pm #4351

    Hi Melissa,

    After discussing this issue further with the Development Team, the decision was made to remove the isValid() and setValid() methods from the Radio Button and Checkbox controls.  The Checkbox isChecked() and Radio Button isSelected() methods allow the user to determine whether the control has been selected/checked by the user.



    However, the Checkbox Group and Radio Button Group controls do support the isValid() and setValid() methods.


    Stephen P.

    Melissa Massey
    May 31, 2017 at 7:16 am #4360

    I was able to use the isValid() in an event and it did the check and added the error text but the error text would not clear after it was valid.  Anyone else come across this issue?

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Start typing and press Enter to search