• Resolved EliWbbr

    (@eliwbbr)


    I’m looking for help with a front end form (see here). I’d like the user to select a radio button that will only display a specific group of form fields. For example if the HWD Doors radio button is selected, only the HWD form fields display.
    Turns out I know far less than I thought so any help would be greatly appreciated! Or can I put in a request for a demo or sample of a front end form using simple conditional logic?
    Thanks!!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I’d check out and give https://github.com/jcchavezs/cmb2-conditionals a try for this. From the looks of it, some extra steps would be needed to make work on the frontend, based on some of the issues I’m reading there.

    Thread Starter EliWbbr

    (@eliwbbr)

    Hi Michael! I just gave this a quick look, but feel better about tackling this project now after peeking at the example functions file. I’ll be able to dig into it more tomorrow! Thanks so much

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Welcome.

    Thread Starter EliWbbr

    (@eliwbbr)

    Okay, I’ve had a chance to play with the cmb2-conditionals files. Do you have any links to reference those extra steps needed to make it work on the front end?
    Thanks Michael!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Thread Starter EliWbbr

    (@eliwbbr)

    Please pardon my ignorance here. Can you help me understand why i don’t have to use this technique to display the form fields on the page?

    <?php
    $text = get_post_meta( $post->ID, '_cmb2_sample_address', true );
    echo $text;
    echo '<br />';						
    $text = get_post_meta( $post->ID, '_cmb2_sample_city', true );
    echo $text;		
    echo ',&nbsp;';
    $select = get_post_meta( $post->ID, '_cmb2_sample_state', true );
    echo $select;	
    echo '&nbsp;';	
    $text = get_post_meta( $post->ID, '_cmb2_sample_zip', true );
    echo $text;		
    ?>

    I followed the CMB2-Snippet-Library/front-end/ example, so everything exists on frontend-form.php; registered objects and fields. And then the shortcode was put on a page in the admin.

    I know i’m working on the front-end, not the admin-side of things…but i can’t seem to find an answer to this and i feel like i’m missing a critical connection in my understanding of this.

    You can pretend explaining it to a 5 year old…i won’t be offended ??

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I don’t see anything wrong with that code. That leaves my biggest question being if those are the right meta field keys and if there are values saved in those for the database. Also possible that $post->ID isn’t returning the right or any value, but I have to assume it would be.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Ever get this resolved @eliwbbr ?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Forms on the front end’ is closed to new replies.