Image Checkbox Widget: How to extract current state in Javascript

  • Profile Image
    natupote
    Asked on June 22, 2016 at 01:03 AM

    Hello everyone and sorry my english

     

    I'm creating a script in javascript on my form, and i need use the info to the current state of the checkbox widget for a condition, how i print the current state in javascript?

     

    Thanks again!

  • Profile Image
    EltonCris
    Answered on June 22, 2016 at 03:27 AM

    Hi there!

    Your English is fine, however, it is not possible to inject or use javacript in the form builder or in the widgets. The form builder will strip off the javascript codes for security reasons. 

    However, if you could please tell us what you want to achieve, we might be able to find a workaround for you. Kindly provide more details about your goal with the image checkbox widget so we can further assist you here.

  • Profile Image
    EltonCris
    Answered on June 22, 2016 at 03:34 AM

    By the way, if you want to extract the value of the selected option on image checkbox widget, you can use the UPDATE/CALCULATE FIELD condition.

    Example:

     

     

    Demo: https://form.jotform.com/61731994699980

    You can also clone this form if you want.

  • Profile Image
    natupote
    Answered on June 22, 2016 at 01:21 PM

    I understand, thanks, but i host my form in a external server, and i add with sucess a javascript code in the default radiobutton, but now i need put the same function in the Image checkbox widget, can you help me? The link of my form is below, the radiobutton with the javascript funtion is in the page 2, option "VITOR", i need put a onclick event in the ImageCheckboxWidget.

    http://natupote.net16.net/SALADA_NO_POTE.html

     

    Thanks for help!

  • Profile Image
    Boris
    Answered on June 22, 2016 at 03:06 PM

    As explained by my colleague above and in your previous thread ( https://www.jotform.com/answers/866354 ), it is not possible to add custom scripts within our widgets.

    Even when using the source code method to customize the form, widgets are still being loaded directly from our own servers, within an iFrame. As such, it is not possible to add custom scripts to the widgets - you can only add custom scripts to regular form fields on your form, when embedding it with source code embed method:

    https://www.jotform.com/help/104-How-to-get-the-Full-Source-Code-of-your-Form

    If you need to add any custom scripts, please try using a regular Check Box field instead of the widget. If you need further clarifications or assistance, please let us know.