Support » Plugin: Ninja Forms - The Easy and Powerful Forms Builder » Populate textarea from querystring

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author James Laws


    The WP Ninjas

    We try to assist everyone who asks for support butss we’ve stated in this sticky thread, we don’t offer support on these forums. This is to help us provide support more efficiently by keeping it all in one channel.

    If you would like support from the developers you can follow the support link it provides and we’d be happy to assist you.

    If you are happy waiting here to see if someone else can assist you you are welcome to do that as well.

    Here’s how I solved it, your mileage may vary. Note that all of the php listed should go in your template’s functions.php file.

    Step 1) Tell WordPress about any custom query string parameters you’re looking for. Source

    function add_query_vars_filter( $vars ){
      $vars[] = "my_query_string_parameter";
      return $vars;
    add_filter( 'query_vars', 'add_query_vars_filter' );

    Step 2) Add an action to the ninja_forms_display_init hook that will run as the form is loaded. Then use get_query_var to get the query string value you’re looking for. Finally, pass that value the Ninja Forms api method update_field_value using the ninja_forms_loading global object.

    function handle_http_query_string( $form_id ){
    	global $ninja_forms_loading;
    	$ninja_forms_loading->update_field_value( my_field_id, get_query_var('my_query_string_parameter'));
    add_action( 'ninja_forms_display_init', 'handle_http_query_string' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Populate textarea from querystring’ is closed to new replies.