I need to be able to access post values from gform_field_value. Is there a way? I have tried $_post and rgpost.
I need to be able to access post values from gform_field_value. Is there a way? I have tried $_post and rgpost.
What exactly are you trying to do, populate a field using the value of post related data? If so, here is a tutorial that discusses how to populate a field using the Post Author that may be able to get you started:
http://www.gravityhelp.com/documentation/page/Dynamically_Populating_the_Post_Author
Hey again Carl.
I'm trying to create a form so that when a person enters their customer code the form auto fills their name and address to the form on the next page.
I'm able to use
add_filter('gform_validation', 'custom_validation');
function custom_validation($validation_result)
to check if I have a valid customer but then I'm unable to use post or a global var to get the customer code to gform_field_value. How can I do that? Also is gform_field_value called before gform_validation?
Here is the form below.
http://dev.cheminc.com/order-form/
Please select I have my customer code and enter "sdaf" (no quotes)
Is it possible get a post value into the function gform_field? Should I try to use a cookie or a global?
Brad
No. gform_field_value fires when the form is displayed, at which point nothing has been post because the post doesn't happen until after the form is submitted. So you can't use something that is triggered when the form is displayed to do something the form is submitted.
You would have to use PHP and jQuery to pre-populate those fields using jQuery using the gform_validation hook to check the field and get the user data based on what is passed and then use jQuery to populate those fields. The gform_page_loaded jQuery hook is documented here:
http://www.gravityhelp.com/documentation/page/Gform_page_loaded
So what you are trying to do can't be done with the standard dynamic field population because you want it to happen via gform_validation which isn't the normal way of populating fields dynamically.
Can I use something like this? http://pastie.org/1432081 I just need a way to grab and prefill fields based on customer ID. I don't have to use gform_validation.
I'm not very good with JS. Can you please send me a more detailed example? Of this http://www.gravityhelp.com/documentation/page/Gform_page_loaded?