• Resolved GreatDayDan

    (@greatdaydan)


    I am a little bit more than a NewBee in WP. No form experience.
    I have a form with only a dropdown on it.
    I have a function that should fill the DD.
    I have added “add_action(‘GetNames’, ‘gddGetNames($form)’);” to my functions.php.
    Is this the way to call the form? Does it need the form Id?

    Thanks…Dan’l

Viewing 2 replies - 1 through 2 (of 2 total)
  • Shiva Poudel

    (@shivapoudel)

    Hi @greatdaydan,

    How are you today?
    Thanks for writing to the WPEverest community.

    I suggest you go through our documentation to get started with Everest Forms.
    https://docs.wpeverest.com/docs/everest-forms/

    Hope this helps,
    If you have any other questions please ask!

    Thank you!

    Kind regards,
    Shiva Poudel

    Thread Starter GreatDayDan

    (@greatdaydan)

    I went through the documentation again. Did not see how to load my data into a dropdown.

    I have this function, which should

    <?php

    function gddGetNames($form){
       if($form["id"] != 225)
           return $form;	
      global $wpdb;
      global $result;
      global $value;
      global $results;
        //Adding initial blank value.
        $items[] = array("text" => "Select the Family name", "value" => "");
      
      $results = $wpdb->get_results ( "SELECT name FROM $wpdb->moFamilyName" , object);
    
      if($results)
       {
        foreach($form["fields"] as &$field)
          {  $field["choices"] = $items;
          }
        return $form;
       }
    add_action('GetNames', 'gddGetNames($form)');
    add_action("GetEvents", 'gddGetEvents'); 
    }

    ?>

    or is this the way to load the dropdown:

    <?php
    function gddGetNames($form){
       if($form["id"] != 225)
           return $form;	
      global $wpdb;
      global $result;
      global $value;
      global $results;
      
    
      $results = $wpdb->get_results ( "SELECT name FROM $wpdb->moFamilyName");
    
      if($results)
       {
        $form.$field["choices"] = $results;
       }
        return $form;
       }
        
         
    
    add_action('GetNames', 'gddGetNames($form)');
    add_action("GetEvents", 'gddGetEvents'); 
    
    	
    }

    ?>

    Thanks…Dan’l

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to call a form?’ is closed to new replies.