Support » Plugin: CMB2 » CUSTOM POST WITH CMB2 – INITIAL NO FORM

  • Resolved dkurth

    (@dkurth)


    I have an interesting chicken and egg question. I have a set of repeatable fields within cmb2, talking to a independent table. WORKS WONDERFULLY!

    Just one hickup, when I create a new post AND if I have required fields within the cmb2 form, before I can publish the new post, I have to place some data within or the post is not published.

    How can I create the post with CBM2 and NOT have a form present, until the user clicks on “New Record”.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Justin Sternberg

    (@jtsternberg)

    Unfortunately that’s the nature of required fields. There is no concept of conditionally-required fields, so you would likely have to build that with some custom javascript, “if ‘New Record’ clicked, add required attributes to fields X, Y, and Z”.

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    I wonder if some parts of this would work with this. https://github.com/jcchavezs/cmb2-conditionals Kind of the nature of input fields. Do display:none fields still trigger required validation checks?

    dkurth

    (@dkurth)

    I will check that out and get back to you. It is certainly no problem with not required fields. I was just wondering if NO fields would be display initially.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘CUSTOM POST WITH CMB2 – INITIAL NO FORM’ is closed to new replies.