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.

Dynamically populate "Job Title" box on new form

  1. Hi guys,
    I wanted to throw this out there for help as I've been trying hard without success to get this working.

    I have a generic application form for a jobs sections that I have on my site. Users will click a link at the bottom of a job they are looking at and be redirect to the application form.

    Is there a way to dynamically populate a text field on the application form with the post name (also the name of the job) that users will be coming through?

    i'm not sure if this is a question about dynamic population or it can be done with the "merge tag" option but I would really excited to know if this is possible!

    Hope to hear back

    Rob

    Posted 11 years ago on Sunday February 17, 2013 | Permalink
  2. Rob, sure. You should be able to do this with dynamic population by using a query string on the link to the form from your jobs pages. Take a look at the query string approach here:

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

    Posted 11 years ago on Sunday February 17, 2013 | Permalink
  3. Hi Rob (nice name),
    I looked through the dynamic population - thanks for confirming that its these I need.
    I understand how to use them to popular the url or post the user is on at the time but is there a way to populate the field with the page name the user has come from?

    Posted 11 years ago on Monday February 18, 2013 | Permalink
  4. What you need to do is on your link to your form from Page A - you need to pass the "title" of Page A in your link to your form page in the link to the form page via a query string on the link. So once they land on the form page, that field will pull from the query string that came from Page A.

    Posted 11 years ago on Monday February 18, 2013 | Permalink
  5. I see what you mean Rob.

    I guess its gonna be difficult to set this up. Reason- I don't specifically want to specify one page title rather I want to be able for the string to basically catch whatever page the user was on before coming to that page - Like a generic string.

    Posted 11 years ago on Thursday February 21, 2013 | Permalink
  6. Right, you would need to write some PHP here to place in your link to the form page to dynamically place the current title of the page in your link.

    Posted 11 years ago on Thursday February 21, 2013 | Permalink
  7. Ok, Rob. I see what you are saying exactly however, it's a little beyond what I am capable of doing sadly.

    Posted 11 years ago on Thursday February 21, 2013 | Permalink
  8. Could I ask for some assistance to make this happen? I am a very enthusiastic learner.

    Posted 11 years ago on Thursday February 21, 2013 | Permalink
  9. You should be able to use something like this:

    <a href="http://www.domain.com/?title=<?php echo get_the_title(); ?>">Form Link</a>

    So "title" would be the paramater name you use on your form field and that PHP snippet will get the current title of the page.

    Posted 11 years ago on Thursday February 21, 2013 | Permalink
  10. Ok, I see Rob. So I the link to the form should have the structure you stated above in to popular the title!! Let me give it a whirl and let you know.

    Posted 11 years ago on Friday February 22, 2013 | Permalink
  11. Rob,

    The dynamic population is working but instead of pulling the actual post title it populates the box with the actual php line <?php echo get_the_title(); ?>

    Do I need something in my functions.php to make it all work?

    Posted 11 years ago on Friday February 22, 2013 | Permalink
  12. Hmm, No - I just tested this and it worked for me. Do you have a link to your page with this link?

    Posted 11 years ago on Friday February 22, 2013 | Permalink
  13. Thanks for the quick response Rob.

    I have put an example on this page. The "Click here" link take you to the applications form.

    http://nagoya-info.com/jobs/market-researcher2813/

    Posted 11 years ago on Friday February 22, 2013 | Permalink
  14. You would need to put this link at the the theme level, as part of the page template. Not in the WP page editor. I believe that's what's wrong here. Have you ever made a custom page template in WP before?

    Posted 11 years ago on Friday February 22, 2013 | Permalink
  15. I feel a little stupid for doing that.
    I don't have so much experience with making custom page templates as up until now I havent needed them so much. I have 5 custom post types all of which pull the standard archive and single page templates.
    To answer your question, no I havent made a custom page template before - In this case, why is a custom template necessary Rob?

    Posted 11 years ago on Friday February 22, 2013 | Permalink
  16. No worries. It's because we need to execute a PHP statement to pass the current page title dynamically.

    Posted 11 years ago on Friday February 22, 2013 | Permalink
  17. Gotcha. So a custom page template for the "Job applications" page is need right?

    Posted 11 years ago on Friday February 22, 2013 | Permalink
  18. Actually, you might be able to give something like this a whirl:
    http://wordpress.org/extend/plugins/shortcode-exec-php/

    To try to create a shortcode for you to use in your page to output that info, rather than creating a new template file.

    Posted 11 years ago on Friday February 22, 2013 | Permalink
  19. Will give it go Rob.
    Thanks for your time!

    Posted 11 years ago on Friday February 22, 2013 | Permalink