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.

Passing data for dynamic population

  1. chucktho
    Member

    I'm trying to follow the instructions found here: http://www.gravityhelp.com/forums/topic/how-to-send-parameters-from-one-from-to-another and I'm having no success at all. There is no confirmation tab on the sending form so I can't follow the directions.

    Here is what I'm trying to do. I have multisite installation with several sub-sites. The sub-sites all have paid memberships. I have a form for becoming a member and there are different prices according to the type of membership. I want to create a form to renew the memberships and I want to include on that form the amount the member originally paid (from the original membership form where I have a Donation Pricing Field) as his renewal fee..

    I've tried to follow the directions on other posts to accomplish this but (a) I don't know how to write a query, and; (b) I don't see on any of the other posts where to put, or what to do with the query if I could write it.

    Can you help please?

    Posted 13 years ago on Monday September 5, 2011 | Permalink
  2. chucktho
    Member

    Bump. No answer to this?

    Posted 13 years ago on Wednesday October 19, 2011 | Permalink
  3. Sorry about that Chuck. It must have slipped off the radar.

    Re "There is no confirmation tab on the sending form so I can't follow the directions."

    You don't have a way to set the confirmation for your form?
    http://www.gravityhelp.com/documentation/page/Form_Settings#Confirmation

    You need to have access to that. It's the 3rd tab over on the Form Settings. We have to start there.

    Posted 13 years ago on Wednesday October 19, 2011 | Permalink
  4. chucktho
    Member

    Sorry about that I must have been so frustrated at that point....

    Yes, I have a Confirmation tab.

    I'm not a coder, so I'm going to need specific instructions please.

    Posted 13 years ago on Wednesday October 19, 2011 | Permalink
  5. chucktho
    Member

    As I re-read the page referenced above, I'm not sure that's the best way to go. It looks like it would eliminate the option of sending a confirmation to the user for the first form.

    Here's what I'm trying to accomplish:
    Form A has a Company field and it uses the User Registration add-on..
    Form B has a Company field. I'd like to populate the Company Field in Form B with the Company Information from Form A. Users of Form B are logged in users. I'm using Insert Variable to populate the email based upon the user being logged in and that's working fine - I am presuming that means that somehow I can populate the logged in user's Company information.

    Posted 13 years ago on Wednesday October 19, 2011 | Permalink
  6. chucktho
    Member

    Can you help to write a query or shortcode to gather information?

    Here's what I'm trying to accomplish:
    Form A has a Company field and it uses the User Registration add-on..
    Form B has a Company field. I'd like to populate the Company Field in Form B with the Company Information from Form A. Users of Form B are logged in users. I'm using Insert Variable to populate the email based upon the user being logged in and that's working fine - I am presuming that means that somehow I can populate the logged in user's Company information.

    Posted 13 years ago on Thursday October 20, 2011 | Permalink
  7. Hi Chuck. I'll give you a hand with this on Friday. Thanks for your patience.

    --Chris

    Posted 13 years ago on Friday October 21, 2011 | Permalink
  8. Hi Chuck. Sounds like you need to grab the company information which is stored with the user meta for the logged in user. It does not sound like the visitor to form B is coming directly from form A, so you will need to determine the logged in user, then grab their meta information. Try something like this in your theme's functions.php:

    [php]
    add_filter('gform_field_value_company', 'populate_company');
    function populate_company($company) {
    	if (is_user_logged_in()) {
    		// if the user is logged in, get the ID and grab the value of the usermeta value for company
    		// change the 'company' to the meta_key value where the company information is stored
    		$company = get_user_meta($current_user->ID, 'company', TRUE);
    	}
    	else {
    		$company = '';
    	}
    	return $company;
    }

    This assumes that the field in form B that holds the company name is set up to allow it to be populated dynamically, and the parameter name is "company". It also assumes the company information is stored in the user meta table with the meta_key of "company". If not, in either case, you will need to change the code above.

    Let us know if you need more help. Thanks.

    Posted 13 years ago on Saturday October 22, 2011 | Permalink
  9. chucktho
    Member

    Thank you. Its not working, but it may be me - I'm not a coder. I'm using Headway 2.103. It has a "main" custom_functions.php file and another one for each sub-site. I've pasted the above code in both. The "main" custom_functions.php had examples only so I pasted the code at the bottom after the examples (which are commented out). The one for the sub-site has code. I pasted your code at the bottom. On the form, I've checked "Allow field to be populated dynamically" and for the Parameter Name I've entered "company_name". I've checked in wp_usermeta and the meta_key "company_name" exists and has a value. Any idea what I'm doing wrong?

    Posted 13 years ago on Monday October 24, 2011 | Permalink
  10. I'm not sure where to put the custom code in a Headway theme. is there any code in that functions file that you are sure IS being executed? That would help determine if it's in the correct place.

    This is correct: "Allow field to be populated dynamically""

    And this is correct: "company_name" and is in the wp_usermeta table.

    If you can export the two forms as XML and email them to me chris@rocketgenius.com , I can install them and see if I made a mistake in the code, or if I can get it working.

    Also, a copy of your function.php (or whatever the name is) where you pasted this code.

    Posted 13 years ago on Tuesday October 25, 2011 | Permalink
  11. Chuck, in the custom_functions.php file you sent me, my code (line 347) still has "company" as the meta key name, not "company_name". Is it correct in your version?

    The key needs to be exactly the same in the code and in the form and custom fields. Let me know before I test further.

    Posted 13 years ago on Wednesday October 26, 2011 | Permalink
  12. chucktho
    Member

    Hi Chris. I'm sorry it took this long to see this - it didn't notify me that you had responded.

    In the original form (the one with the company name) the Field Label is "Company Name" - I presume Gravity changes that to company_name somehow.

    I've changed it to company_name on the custom functions file.

    On the form I'm trying to populate dynamically, the Field Label is "Company Name" and the parameter name is company_name.

    It still doesn't work. Thank you so much for you help and again, I'm sorry it took this long to respond.

    Posted 13 years ago on Monday November 7, 2011 | Permalink
  13. chucktho
    Member

    Bump. Just checking, anything new on this issue? Thanks, Chuck

    Posted 13 years ago on Wednesday November 16, 2011 | Permalink
  14. Hi Chuck. Did you ever send me this form? I can't find it. I know we were working on a couple things. Please export the form as XML and email it to me, with a reference to this topic, and also in the email explain where you're at right now, what you need help with.

    I think we need to know how the data is being stored, what the exact meta_key name is in the database. Do you have a way to check that? Screenshot, or a link to the plugin or something? We need to know that to be able to match it up in the form.

    Posted 13 years ago on Thursday November 17, 2011 | Permalink