Support » Plugin: Pods - Custom Content Types and Fields » Frontend-Forms: Hide field in UI?

  • Resolved formlos

    (@formlos)


    Hey there,

    we are showing a form on the frontend via

    $mypod = pod('custom_type');
    $fields = array('name', 'images', 'relationship' => array('type' => 'text', label => 'Relationship label', 302));
    echo $mypod->form($fields)

    In the field relationship we need to set the ID for another custom content type. But this field is editable in the generated form. The problem is, users can edit this ID and mess everything up 🙂

    We tend to hide this form input via CSS, but this is not a very ‘nice’ solution.

    So: is there any way to achieve this in conjuction with pods->form()?

    I already searched for a solution in this forum, but to no avail (https://wordpress.org/search/pods+form+hide+intext%3A%22Plugin%3A+Pods+-+Custom+Content+Types+and+Fields%22)

    • This topic was modified 1 month, 3 weeks ago by formlos.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @formlos

    You can add the parameter 'hidden' => true in your field settings.

    Example:

    
    $mypod = pod('custom_type');
    $fields = array('name', 'images', 'relationship' => array('type' => 'text', label => 'Relationship label', 'hidden' => true, 302));
    echo $mypod->form($fields)
    

    Cheers, Jory

    Thread Starter formlos

    (@formlos)

    Wow, perfect – thank you. This works!

    PS: maybe you should add this in the documentation: https://pods.io/docs/code/pods/form/

    • This reply was modified 1 month, 3 weeks ago by formlos.
    Plugin Author Jory Hogeveen

    (@keraweb)

    You’re welcome! The best way to say thanks is to leave a 5 star review at https://wordpress.org/plugins/pods/ and (if you’re feeling especially generous) become a Friend of Pods at https://friends.pods.io/

    PodsForm is something that still needs a lot of work before we can write complete documentation on this subject.
    We advice using GravityForms with our addon at the moment.

    Cheers, Jory

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.