PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

How to add value to checkboxes and check if conflicting

  1. Sprutt
    Member

    Hi!

    I'm making a form which should display a list of events as checkboxes. The users is meant to be able to choose as many as they like, as long as the time of the event is not conflicting with any of the ones they already have chosen.

    So I guess what needs to be done is adding another value field for each checkbox and then run a check for conflicts when new boxes are checked.

    Is this even possible? If so, how? Or maybe there's a better way to do this?

    Thanks in advance, best regards!

    Posted 11 years ago on Thursday November 8, 2012 | Permalink
  2. You can do this, but the logic and validation will need to be done on the front end of the site, in the browser, using jQuery. Gravity Forms can only handle the validation after the form is submitted the first time. It sound like you want to prevent the selection from happening in the first place. The only way I can think of to handle this functionality is with jQuery (or JavaScript.)

    Posted 11 years ago on Sunday November 18, 2012 | Permalink
  3. Sprutt
    Member

    Thanks for your response Chris!

    I will look into jQuery for the selection functionality.

    But what about adding a second "value" to each checkbox. I want to have an events name in one and it's time in the other. See example image.

    Cheers!

    Posted 11 years ago on Monday November 19, 2012 | Permalink
  4. I did not know checkboxes could have more than one value. Is that what you're trying to do, give two values to one checkbox?

    Posted 11 years ago on Monday November 19, 2012 | Permalink
  5. Sprutt
    Member

    That isn't possible perhaps :)

    I was just hoping to be able to do it aswell, to make the checkboxes look nicer, but maybe it's conflicting with the basic mechanics of HTML..?

    Posted 11 years ago on Tuesday November 20, 2012 | Permalink
  6. David Peralty

    Yeah, as far as I know, you can't give two values to a check box, even just in straight HTML.

    Posted 11 years ago on Tuesday November 20, 2012 | Permalink