What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    How to change functionality of Ticket Purchase widget to act like radio button field

    Asked by chrispp10 on February 08, 2016 at 03:23 PM
    s there a way when the max is 1 and the min is 1

    is there a way to make it auto deselect when you click on another choice instead of you having to deselect your previous choice and reselect the new one ?

    ticket purchase widget
  • Profile Image

    Answered by chrispp10 on February 08, 2016 at 03:25 PM

    I thought this would work but it seems like it is not working 

     

    $(document).ready(function () {

            $("#checklist li").click(function () {

                $("#checklist li").removeClass('clicked');

                $(this).addClass('clicked');

     

            });

      });

     

  • Profile Image
    JotForm Support

    Answered by BJoanna on February 08, 2016 at 03:34 PM

    Unfortunately this is not possible to achieve. Functionality that you want is radio button functionality, and Ticket Purchases widget is check box field.

    I think this would be possible to achieve if you would embed your form to website using full source code and if you add additional JavaScript functions. If you are not able to to it your self, to would be the best to hire a developer to do it for you.

    Feel free to contact us if you have any other questions.

  • Profile Image

    Answered by chrispp10 on February 08, 2016 at 03:50 PM

    There has to be a javascipt that allows for check boxes to be unselected 

  • Profile Image
    JotForm Support

    Answered by Kevin_G on February 08, 2016 at 08:57 PM

    It would be better to use the radio buttons instead, you can not add custom Javascript codes because before it was allowed, but some users were using those script for other purposes rather than just collect data.

    If you would like to add Javascript codes you will need to get the Full Source Code as explained by my colleague above.

  • Profile Image

    Answered by chrispp10 on February 11, 2016 at 03:24 PM

    Thanks for the response 

    I have the full source code but as of now I can not bypass the iframe for security reasons 

    is there a way around it that you know of ?

     

    I was trying to use this 

    var doc=document.getElementById("customFieldFrame_35").contentDocument;

     

  • Profile Image
    JotForm Support

    Answered by Kevin_G on February 11, 2016 at 04:42 PM

    Please, allow me some time, I will test a Javascript code and will get back to you as soon as I have it working.

    Thank you.

  • Profile Image
    JotForm Support

    Answered by Kevin_G on February 11, 2016 at 05:09 PM

    Take a look on this sample: http://pastebin.com/raw/kka2HFXg

    It should work as you need.

  • Profile Image

    Answered by chrispp10 on February 11, 2016 at 05:21 PM

    Thanks for the response 

     

    where exactly am i inserting this and will it work for all checkboxes on my form ?

    i only want it to work if the min is 1 and the max is 1

     

    so if you can choose more than one choice i do not want this to apply 

  • Profile Image
    JotForm Support

    Answered by Kevin_G on February 11, 2016 at 06:32 PM

    You will need to add one of this functions per check box in your form:

    function check1(box) {

            if (box.checked) {

                document.getElementById("checkbox2").checked=false

            }

    }

    Just replace the highlighted text with the ID of the check box that you want to apply the function.

    It will only work with one, as you requested, if you have checked an option and you try to check other option, then the previous checked option will be cleared, this basically will work the same as the radio buttons.

     

  • Profile Image

    Answered by chrispp10 on February 11, 2016 at 06:49 PM

    does it matter where i apply the function?

    Can i put it anywhere in the source ?

     

    also the only think im changing is "checkbox2" i dont need to change check1 or box per different functions ?

  • Profile Image

    Answered by chrispp10 on February 11, 2016 at 07:00 PM

     

    I was testing with inspect element and it seems as though it is not working ?

    I inserted the code into inspect element and it made no different ?

  • Profile Image
    JotForm Support

    Answered by Kevin_G on February 11, 2016 at 08:11 PM

    Are you trying to use this with the widget shown in your image? 

    If yes, then I think that it's not possible, since you only get the iFrame code of the widget, you do not get the source code, and the Javascript provided above only works with the normal check boxes.

  • Profile Image

    Answered by chrispp10 on February 11, 2016 at 08:21 PM

    Yes im trying to use it with that 

    no there is no way around it whatsoever ?

  • Profile Image
    JotForm Support

    Answered by beril on February 12, 2016 at 04:27 AM

    As my colleague was mentioned before, the only way is adding the javaScript code to your source code. Otherwise, it will not work.

    I've also looked for a solution for behaving as radio button. It seems there is no way to change the functionality of widget without adding JavaScript code.

    Please, check the guide below for more information.

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

     

  • Profile Image

    Answered by chrispp10 on February 12, 2016 at 10:19 AM

    I understand how to get the source code already have it

    also i know i need to add javascript

     

    can you guys aid me in achieving this javascript that will work?

  • Profile Image
    JotForm Support

    Answered by ashwin_d on February 12, 2016 at 12:55 PM

    Hello chrispp10,

    I went through the entire post and it seems you are already aware that widget code is loaded separately inside an iFrame within the form. That's really going to e challenge since widgets work separately from separate domain.

    I will take a look and try to figure out if there is any workaround possible. I do not think it is possible but I will get back to you if I figure out any workaround.

    Thank you!

  • Profile Image

    Answered by chrispp10 on February 12, 2016 at 03:29 PM

    alright thanks I have been working with this to see if i can get a workaround 

    http://stackoverflow.com/questions/25098021/securityerror-blocked-a-frame-with-origin-from-accessing-a-cross-origin-frame/25098153#25098153

  • Profile Image

    Answered by chrispp10 on February 12, 2016 at 03:36 PM

    Also I am going to make a thread but maybe you guys can help me here as well 

     

    is it possible to have the form, once the submit button is hit, to recheck the ticket purchases widget to make sure there spots are available before submitting 

     

    reason being because, lets say there is one spot left in a class, but two users open the form at the same time, if the first user complete the form and submits, it should make the spot unavailable for the second user but for some reason the user is still able to submit the form with the sold out spot because it only updates if the form us refreshed or the form is opened after the submission is sent

    so if you are on the form before it is submitted it acts as though there is still spots available which ends up over selling

    so i need another check while the for, is being submitted   

  • Profile Image
    JotForm Support

    Answered by Kevin_G on February 12, 2016 at 04:56 PM

    I'm not sure if the workaround provided on the link you shared us will work, since as explained there, the code within an iFrame can not be modified with Javascript.

    In regards to the second question, I think that this link will help you: http://stackoverflow.com/questions/4249809/reload-an-iframe-with-jquery.

    Since the only way to refresh the options without refreshing the entire webpage, is loading only the iFrame.

    If you would like to discuss further this option, please open a new thread, we will be glad to assist you there.

  • Profile Image

    Answered by chrispp10 on February 12, 2016 at 06:37 PM

    Here is a copy of my new thread 

    http://www.jotform.com/answers/771362-Recheck-users-ticket-purchases-before-submitting/?entrymessage=10732640770

  • Profile Image
    JotForm Support

    Answered by Kevin_G on February 12, 2016 at 11:59 PM

    I can see there are multiple threads about the same question, so one of my colleagues will assist you soon in one of them.

  • Profile Image

    Answered by chrispp10 on February 13, 2016 at 05:27 PM

    Kevin_G can you please assist me on getting this working please

  • Profile Image
    JotForm Support

    Answered by Kevin_G on February 13, 2016 at 09:19 PM

    I will post my reply on this thread: http://www.jotform.com/answers/771368-Recheck-ticket-purchases-before-submitting#3.

    Please follow only that thread, and please avoid to post any replay in other threads, this will help us to get confused and we will be able to assist you better.

  • Profile Image

    Answered by grade4pagasa on August 07, 2016 at 02:43 PM

    Hi chrispp10

    The definition of the Ticket Purchases is: This widget is a checklist of different types of tickets... allowing you to set limits on each ticket option.

    Caveat

    Since the widget is technically a checklist, we need to unselect an option to be able to select another to force it to behave like a radio button.

    Hope this helps.

    - Randy, fellow JotForm user