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.

pre-populate help

  1. stacker02
    Member

    I have created a few custom meta boxes for product information using the code below:

    <h1 class="product"><?php the_title(); ?></h1>
    <strong>Auteur:</strong>&nbsp;<?php echo get_post_meta($post->ID, author, true); ?><br/>
    <strong>Prijs:</strong>&nbsp;€<?php echo get_post_meta($post->ID, price, true); ?><br/>
    <strong>ISBN:</strong>&nbsp;<?php echo get_post_meta($post->ID, isbn, true); ?><br/>
    <strong>Uitgever:</strong>&nbsp;<?php echo get_post_meta($post->ID, publisher, true); ?><br/>
    <strong>Uitvoering:</strong>&nbsp;<?php echo get_post_meta($post->ID, format, true); ?><br/>
    <strong>Verschenen:</strong>&nbsp;<?php echo get_post_meta($post->ID, releasedate, true); ?><br/><br/>

    I have a button on the WordPress page that lets you send an email to the shop to check if this product is available. What do I need to do to pre-populate the fields I have on the GF with:

    <?php the_title(); ?>
    <?php echo get_post_meta($post->ID, author, true); ?>
    <?php echo get_post_meta($post->ID, isbn, true); ?>
    <?php echo get_post_meta($post->ID, publisher, true); ?>

    Thanks for any help!

    Posted 9 years ago on Friday July 8, 2011 | Permalink
  2. You can find a tutorial on how to dynamically populate fields in Gravity Forms here:

    http://www.gravityhelp.com/documentation/page/Using_Dynamic_Population

    Posted 9 years ago on Friday July 8, 2011 | Permalink
  3. stacker02
    Member

    Carl, Thanks for the help on pointing this out. I been reading many articles like this but unfortunately it's all a little foreign to me even as clear as it seems.

    I am a visual learner so ready that code and trying to figure out how to fits to my code is hard for me to put together. Any chance I get 1 example how that might look for the code I gave then I might be able to comprehend it a bit more.

    Thanks!!!

    Posted 9 years ago on Saturday July 9, 2011 | Permalink
  4. Hi stacker02,

    I wrote an example with the author field. I've named the hook 'gform_field_auteur', the 'auteur' part of the hook is what you called the parameter for prepopulating that specific field.

    Good luck!

    Posted 9 years ago on Saturday July 9, 2011 | Permalink
  5. stacker02
    Member

    illutic, thanks for the reply. the code is definitely making sense to me now. I wish it worked when I put it all together, but that's another story :)

    I wanted to start with the code. I put it in my functions.php : http://tinypic.com/r/2lo3tza/7

    Then I added the parameter in the form: http://tinypic.com/r/2lb1fmw/7

    But nothing. Here is the URL: http://bit.ly/otVQjQ

    Do you think it has something to do with it being in the shadowbox?

    Here is what the code on the page looks like:

    <div class="entry-article">
    <div style="float:left;">
    <?php the_post_thumbnail( 'boeken-post-thumbnail' ); ?></div>
    <div style="float:left; width:350px; margin-left:15px; font-size:12px; line-height:18px;">
    
    <h1 class="product"><?php the_title(); ?></h1>
    <strong>Auteur:</strong>&nbsp;<?php echo get_post_meta($post->ID, author, true); ?><br/>
    <strong>Prijs:</strong>&nbsp;€<?php echo get_post_meta($post->ID, price, true); ?><br/>
    <strong>ISBN:</strong>&nbsp;<?php echo get_post_meta($post->ID, isbn, true); ?><br/>
    <strong>Uitgever:</strong>&nbsp;<?php echo get_post_meta($post->ID, publisher, true); ?><br/>
    <strong>Uitvoering:</strong>&nbsp;<?php echo get_post_meta($post->ID, format, true); ?><br/>
    <strong>Verschenen:</strong>&nbsp;<?php echo get_post_meta($post->ID, releasedate, true); ?><br/><br/>
    
    <?php echo do_shortcode('[button style="info" size="small" color="silver" link="http://stackmacdesigns.com/clients/boek/?page_id=177" rel="shadowbox"]informatie vragen[/button]'); ?></a>
    </div>

    Thanks for the feedback

    Posted 9 years ago on Wednesday July 13, 2011 | Permalink
  6. stacker02
    Member

    update.

    I have tried the custom code for calling the author´s email and it works. So it seems the it´s something with my plugin "more-fields" which I am using to create the product details.

    Not sure where to figure it out.

    I am willing to pay to have this figured out :)

    Posted 9 years ago on Friday July 15, 2011 | Permalink
  7. stacker02
    Member

    Ok, update. Thanks to illutic I found what I was missing. In your code I just needed to add "value_" to the first value.

    add_filter('gform_field_auteur',
    
    add_filter('gform_field_value_auteur',

    Now I have the data passing correctly.

    Posted 9 years ago on Saturday July 16, 2011 | Permalink