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.

gform product field validation error using pre-render

  1. Hello,

    I am pre rending a product field. The product field is a radio type and it is required.

    But even though my pre rendering works, and I selected one, I still get the 'This field is required.'

    See screenshot: i.imgur.com/znMkAiA.png

    This is my pre render code. It works fine.

    add_filter("gform_pre_render", "product_items");
    // add_filter("gform_admin_pre_render", "product_items");
    function product_items($form){
        if($form["id"] != 2) return $form;
        $products = get_field('item_information',$post->ID);
        $items = array();
        foreach($products as $product)
    		$items[] = array( "text" => $product['order_description'].' <em class="muted">€'.$product['price_euro'].'</em>', "value" => $product['price_euro'] );
        foreach($form["fields"] as &$field){
            if($field["id"] == 1 ){
                $field["choices"] = $items;
                $field["label"] = get_the_title($post->ID);
            }
    	}
        return $form;
    }

    I dont understand why it wont pass the validation even when it is selected?

    Any help into understanding why I am having validation issues would be great thanks.

    Posted 11 years ago on Friday March 22, 2013 | Permalink
  2. Try adding this filter as well:

    [php]
    add_filter("gform_pre_submission", "product_items");
    Posted 11 years ago on Sunday March 24, 2013 | Permalink
  3. Hi chris, thanks for getting back so quick.

    This looked promising but no it does not change it?

    This is the page the form is on. See form live here

    If you click the green order button. A pop up should appear.

    See this screenshot

    Posted 11 years ago on Monday March 25, 2013 | Permalink
  4. This is my code now...

    //PRE RENDER ITEM
    add_filter("gform_pre_submission", "product_items");
    add_filter("gform_pre_render", "product_items");
    // add_filter("gform_admin_pre_render", "product_items");
    function product_items($form){
        if($form["id"] != 2) return $form;
        $products = get_field('item_information',$post->ID);
        $items = array();
        foreach($products as $product)
    		$items[] = array( "text" => $product['order_description'].' <em class="muted">€'.$product['price_euro'].'</em>', "value" => $product['price_euro'] );
        foreach($form["fields"] as &$field){
            if($field["id"] == 1 ){
                $field["choices"] = $items;
                $field["label"] = get_the_title($post->ID);
            }
    	}
        return $form;
    }
    Posted 11 years ago on Monday March 25, 2013 | Permalink
  5. I'll ask the development team if they have any ideas for you. Maybe there is something I've overlooked. Thank you.

    Posted 11 years ago on Monday March 25, 2013 | Permalink
  6. Hi Chris. Thanks for looking into this for me. I think it might be an issue with the pricing fields.

    The site maybe going live today - and going over checks, etc, so I need the form to work. So what I have done for temporary measures is removed the product and the quantity field. Then replaced them with the standard radio field (item) and the number field (quantity).

    The form id=2 now submits fine but I cant calculate a total from this automatically.

    I duplicated my orignal broken form id=2 and is now a test form id=3.

    I moved the form to a test item page please click here to view - the password is redacted

    If you require admin access, please send me your email and I can make you a admin user if you wish to investigate the form setup?

    My new pre-render function is here gist.github.com/jcranny/21f25d6be47070546d9b

    Thanks

    Posted 11 years ago on Tuesday March 26, 2013 | Permalink
  7. We have had a slight issue. My colleague sent the link to the client and the client sent the link to the customers. Before it is even finished.

    So what I have done is locked the website from the public to stop the customer using it.

    I will need your email when you get round to this create you a user account so you can access the site/form again.

    Thank you.

    Posted 11 years ago on Wednesday March 27, 2013 | Permalink
  8. Hi Josh,

    I'm happy to take a look. You can send any login info to david[at]rocketgenius[dot]com.

    Posted 11 years ago on Wednesday March 27, 2013 | Permalink
  9. Hello, I have made you an admin.

    You will see the test form is ID3 and it is on a test page. The test page is password protected but you should be able to see it as your an admin. The password for the page is redacted

    But you should get the password for your user to your email.

    Please contact me on my admin email if you need any instant questions answering.

    Thanks
    Josh

    Posted 11 years ago on Tuesday April 2, 2013 | Permalink
  10. I will close this topic. Please use the priority support form and mark the request "Attention David Smith", or use David's email david@rocketgenius.com

    I removed the passwords from this topic.

    Thank you.

    Posted 11 years ago on Tuesday April 2, 2013 | Permalink

This topic has been resolved and has been closed to new replies.