Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #284947

    Hi, Would appreciate help on how to add information like “type=tel” and “type=email” to the input fields on forms so that the right keyboard will appear on phones.when entering text nto that fields.

    The form is

    [av_contact (Email address hidden if logged out) ' title='Contact Us' button='Contact me now' on_send='' sent='Thanks we will contact you ASAP. Regards, Force' link='manually,http://' subject='Inquiry from web site' autorespond='' captcha='' custom_class='']
    [av_contact_field label='Full Name' type='text' options='' check='is_empty' width=''][/av_contact_field]
    [av_contact_field label='Phone Number' type='text' options='' check='is_phone' width=''][/av_contact_field]
    [av_contact_field label='E-Mail' type='text' options='' width='' check=''][/av_contact_field]
    [av_contact_field label='Your Message' type='textarea' options='' width='' check=''][/av_contact_field]
    [/av_contact]

    #285089

    Hey Denis!

    In wp-content/themes/enfold/framework/php/class-form-generator.php replace:

    
    		function text($id, $element)
    		{
    			$p_class = $required = $element_class = $value = "";
    			
    			$type = 'text';
    			// if($element['check'] == "is_email") $type = 'email'; //cant use this because of ie8 + 9
    			
    			if(!empty($element['check']))
    			{
    				$required = ' <abbr class="required" title="required">*</abbr>';
    				$element_class = $element['check'];
    				$p_class = $this->check_element($id, $element);
    			}
    
    			if(!empty($_POST[$id])) $value = urldecode($_POST[$id]);
    
    			$this->elements_html .= "<p class='".$p_class.$element['class']."' id='element_$id'>";
    			$form_el = ' <input name="'.$id.'" class="text_input '.$element_class.'" type="'.$type.'" id="'.$id.'" value="'.$value.'"/>';
    			$label = '<label for="'.$id.'">'.$element['label'].$required.'</label>';
    
    			if(isset($this->form_params['label_first']))
    			{
    				$this->elements_html .= $label.$form_el;
    			}
    			else
    			{
    				$this->elements_html .= $form_el.$label;
    			}
    
    			$this->elements_html .= "</p>";
    		}
    

    with

    
    		function text($id, $element)
    		{
    			$p_class = $required = $element_class = $value = "";
    			
    			$type = 'text';
    			// if($element['check'] == "is_email") $type = 'email'; //cant use this because of ie8 + 9
    			
    			if(!empty($element['check']))
    			{
    				$required = ' <abbr class="required" title="required">*</abbr>';
    				$element_class = $element['check'];
    				$p_class = $this->check_element($id, $element);
    			}
    
    			if(!empty($_POST[$id])) $value = urldecode($_POST[$id]);
    
    			$this->elements_html .= "<p class='".$p_class.$element['class']."' id='element_$id'>";
    			$form_el = ' <input name="'.$id.'" class="text_input '.$element_class.'" type="'.$type.'" id="'.$id.'" value="'.$value.'"/>';
    			$label = '<label for="'.$id.'">'.$element['label'].$required.'</label>';
    
    			if(isset($this->form_params['label_first']))
    			{
    				$this->elements_html .= $label.$form_el;
    			}
    			else
    			{
    				$this->elements_html .= $form_el.$label;
    			}
    
    			$this->elements_html .= "</p>";
    		}
    
            function email($id, $element)
            {
                $p_class = $required = $element_class = $value = "";
    
                $type = 'email';
                // if($element['check'] == "is_email") $type = 'email'; //cant use this because of ie8 + 9
    
                if(!empty($element['check']))
                {
                    $required = ' <abbr class="required" title="required">*</abbr>';
                    $element_class = $element['check'];
                    $p_class = $this->check_element($id, $element);
                }
    
                if(!empty($_POST[$id])) $value = urldecode($_POST[$id]);
    
                $this->elements_html .= "<p class='".$p_class.$element['class']."' id='element_$id'>";
                $form_el = ' <input name="'.$id.'" class="text_input '.$element_class.'" type="'.$type.'" id="'.$id.'" value="'.$value.'"/>';
                $label = '<label for="'.$id.'">'.$element['label'].$required.'</label>';
    
                if(isset($this->form_params['label_first']))
                {
                    $this->elements_html .= $label.$form_el;
                }
                else
                {
                    $this->elements_html .= $form_el.$label;
                }
    
                $this->elements_html .= "</p>";
            }
    
            function tel($id, $element)
            {
                $p_class = $required = $element_class = $value = "";
    
                $type = 'tel';
                // if($element['check'] == "is_email") $type = 'email'; //cant use this because of ie8 + 9
    
                if(!empty($element['check']))
                {
                    $required = ' <abbr class="required" title="required">*</abbr>';
                    $element_class = $element['check'];
                    $p_class = $this->check_element($id, $element);
                }
    
                if(!empty($_POST[$id])) $value = urldecode($_POST[$id]);
    
                $this->elements_html .= "<p class='".$p_class.$element['class']."' id='element_$id'>";
                $form_el = ' <input name="'.$id.'" class="text_input '.$element_class.'" type="'.$type.'" id="'.$id.'" value="'.$value.'"/>';
                $label = '<label for="'.$id.'">'.$element['label'].$required.'</label>';
    
                if(isset($this->form_params['label_first']))
                {
                    $this->elements_html .= $label.$form_el;
                }
                else
                {
                    $this->elements_html .= $form_el.$label;
                }
    
                $this->elements_html .= "</p>";
            }
    

    and then add two new form fields to your form like:

    
    [av_contact_field label='Phone Number' type='tel' options='' check='is_empty' width=''][/av_contact_field]
    [av_contact_field label='Email' type='email' options='' check='is_empty' width=''][/av_contact_field]
    

    Cheers!
    Peter

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.