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.

Several questions regarding online ordering form

  1. DeeTaG
    Member

    Hi everyone.

    I'm currently working on a form for a food home delivery service.
    I created a multi page form to split the "address" section from the "ordering" section.

    I'm stuck now at some points and was wondering if you guys could maybe help me out.

    1.)
    My first question is regarding the address field.
    Is there any possibilty to realize the zip code input with a dropdown menu because the delivery service is only delivering to some defined zip codes. That's why I would like to change the "open" text field to a dropdown menu.

    2.)
    For the food ordering I created 3 fields, "product", "quantity" and "option".
    Is there any way to link the "option" text field with the equal "product" field?
    Because the "option" fields are not listed in the "ordering" table in the confirmation email the admin receives after sending the form.

    3.)
    Is there any way to categories the products in the "product" dropdownmenu?
    For example:
    Starter:
    - Product 1
    - Product 2
    Main:
    - Product 3
    - Product 4
    Dessert:
    - Product 5
    - Product 6

    4.)
    And the last question is regarding the confirmation text the costumer should see after sending the form. Unfortunately I can't see anything after sending...

    I hope I could describe my questions clearly.
    For better understanding, here is a link to my current ordering form (sorry, the whole form is in german):
    http://deetag.de/souvlaki-haus/wordpress/bestellen-online/

    Thanks in advance for your help.
    Best from germany.
    Dee!

    Posted 13 years ago on Tuesday May 8, 2012 | Permalink
  2. Hey Dee, tried pulling up your site earlier but was getting a server not found error. So, I'm going to try to help you out as much as I can here blindly.

    1 - You will need to create your own separate fields for address if you want the Zip Code to be a drop down. The Advanced Field is what it is.

    2 - When you have more than one product field and you add an option field, you will see a drop down in the option field editor to select which product it goes to. When you just have one product field, all options are tied to that one field.

    3 - There isn't a way to do this with the current product field, however you could use section breaks in combination with product fields. So section break that says Starter: then the appropriate product fields under that. Then another section break that says Main: and the appropriate product fields under that, etc.

    4 - Can you give more detail on this one, is this the confirmation text that shows on the site after submission, or notifications that are sent to the admin/user after form submission?

    Posted 13 years ago on Wednesday May 9, 2012 | Permalink
  3. DeeTaG
    Member

    Hey Rob. Thank you for your quick reply.

    Regarding 1 - I think I found a workaround for that. I created a zip code selection as the first step of the form. That is the easiest way for that at the moment I think.
    Is there maybe any way to "transport" the zip code selection from step one to the zip code field of the address field in step 2?

    Regarding 2 - I found the "option" field for the products. But there is now way to change the "style" of that field to a text file were the costumer can write down his own option, right? I'm talking abou options like "without onions" etc.
    I think it is too difficult to create a options dropdown menu for a food delivery service.

    Regarding 3 - Great idea... I will try that :)

    Regarding 4 - After sending the form I only see the 100 % "status bar", but nothing else. In my options I created a comfirmation message, but I can't see that.
    In the Wordpress backend / form preview mode, the confirmation message is displayed correctly after sending the form.

    I can't explain why you wasn't able to reach the server but here is the link to the form again.
    Hope it will work this time.
    http://www.deetag.de/souvlaki-haus/wordpress/bestellen-online/

    Thank you!
    Best regards,
    Dominik

    Posted 13 years ago on Wednesday May 9, 2012 | Permalink
  4. 1 - We do have dynamic population ability on our form fields, however in this case in particular you'd need to use jQuery to populate the Zip portion of the Address Field from your radio buttons on the first page.

    2 - You should be able to achieve this with conditional logic. So you could placed a single line text field that has conditional logic to only show if a certain option is selected. In which that field can have the instructions in either the field label or the field description.

    3 - Great, I knew I at least had one good idea! :)

    4 - If it works in the formbuilder preview, then that means there is a conflict of some kind either in your theme or in another plugin. Either related to JS or AJAX most likely. Follow the instructions here to test for that: http://www.gravityhelp.com/documentation/page/Testing_for_a_Theme/Plugin_Conflict

    Posted 13 years ago on Wednesday May 9, 2012 | Permalink
  5. DeeTaG
    Member

    Hi Rob.

    Thanks again for you quick help.

    Regarding 1 - I found a snippit posted by wsnider28 (http://www.gravityhelp.com/forums/topic/populate-field-from-previous-field#post-48722)

    and edited the code as written in the descriptions:
    - form ID to "2"
    - page number to "2" (target field is on the second page)
    - target field ID to "14" (address field on the second page)
    - source field ID to "input_2_25" (radio buttons on the first page)

    but it isn't working at all. I also checked the "Allow field to be populated dynamically" option of the address field on the second page but didn't fill out the parameter boxes yet. I don't really know how to do that.

    I'm sorry but my coding skills are quiet low, so maybe you can help me with that.

    <?php
    
    // update "108" to the ID of your form
    add_filter("gform_pre_render_2", "populate_previous_page_data");
    function populate_previous_page_data($form){
    
        $page_number = rgpost("gform_target_page_number_{$form["id"]}");
        $page_number = !is_numeric($page_number) ? 2 : $page_number;
    
        foreach($form['fields'] as &$field) {
    
            if($field['id'] != 14) // update "15" to the ID of the field you wish to be populated;
    
            $field_page = rgar($field, 'pageNumber');
    
            if($page_number > $field_page)
                continue;
    
            // update this to the ID of the field whose value you wish to call
            // '16.3' = example, first name of a Name field
            // '16.6' = example, last name of a Name field
            $field['defaultValue'] = rgpost('input_2_25'); 
    
        }
    
        return $form;
    }

    Regarding 2-4 - I couldn't solve everything yet, but I think I'm fine so far with all your advices.

    Thank you.
    Best regards,
    Dominik

    Posted 13 years ago on Thursday May 10, 2012 | Permalink
  6. DeeTaG
    Member

    // addition:

    I noticed that a "<?php" tag in my functions.php was placed wrong... I fixed that (so please forget line 1 in the code snippet, posted above)... but it still isn't working.

    Posted 13 years ago on Thursday May 10, 2012 | Permalink
  7. Dominik, like I said above, because of how the address field is structured, you won't be able to use built-in dynamic population. If you had split fields (independent fields) that make up the Address then you could pass the Zip into a single line text field.

    Glad you are making some progress with everything though. Menu/Food/Restaurant Ordering Forms are always beasts!

    Posted 13 years ago on Thursday May 10, 2012 | Permalink
  8. DeeTaG
    Member

    Hi Rob.

    Oh okay, I somehow overread that fact. I will give it a try.

    Thank you for all your help so far!!

    Posted 13 years ago on Thursday May 10, 2012 | Permalink