# Replacing the input with a custom one \[RESOLVED\]

**URL:** <https://community.gravityforms.com/t/replacing-the-input-with-a-custom-one-resolved/104>\
**Category:** Get Help\
**Tags:** html5\
**Created:** [October 17, 2018, 9:30pm UTC](https://community.gravityforms.com/t/replacing-the-input-with-a-custom-one-resolved/104 "2018-10-17T21:30:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![viainterativa](https://avatars.discourse-cdn.com/v4/letter/v/c57346/32.png) [@viainterativa](https://community.gravityforms.com/u/viainterativa)\
**Post date:** [October 17, 2018, 9:30pm UTC](https://community.gravityforms.com/t/replacing-the-input-with-a-custom-one-resolved/104/1 "2018-10-17T21:30:29Z")

</div>

Dear, I’m using as the base line of code: [https://docs.gravityforms.com/gform\_field\_input/#highlighter\_445276](https://docs.gravityforms.com/gform_field_input/#highlighter_445276).  
I am creating a php and adding in function.php to change some information that is important of the input. The big question is, I need to make the change from type = “text” to type = “email” to all fields of the form that is email. Do you have any way to automatically identify all email input?  
In my code below, my function is configured to look for the form and the specific field, which generates a bit of work and problems if a field is changed.

```
    add_filter( 'gform_field_input', 'tracker', 10, 5 );
function tracker( $input, $field, $value, $lead_id, $form_id ) {
    if ( $form_id == 1 && $field->id == 2 ) {
		$input = '<input name="input_2" id="input_1_2" type="email" value="" class="large" aria-required="true" aria-invalid="false">';
		return $input;
	}
	if ( $form_id == 2 && $field->id == 3 ) {
		$input = '<input name="input_3" id="input_2_3" type="email" value="" class="large" aria-required="true" aria-invalid="false">';
		return $input;
	}
}

```

is it possible to automatically configure for the function to modify all forms created in the email field type = “text” for type = “email” without having to specify the form id and field id?

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [October 17, 2018, 9:33pm UTC](https://community.gravityforms.com/t/replacing-the-input-with-a-custom-one-resolved/104/2 "2018-10-17T21:33:11Z")

</div>

Are you trying to make the change on the fly, for any text field, to change it to an email field? Are there any other text fields in the form that could inadvertently be affected by this code if it were to apply to all forms.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [October 17, 2018, 9:33pm UTC](https://community.gravityforms.com/t/replacing-the-input-with-a-custom-one-resolved/104/3 "2018-10-17T21:33:40Z")

</div>

Also, can you explain why you’re trying to do this? What is the use-case?

---

<div class="post-metadata">

**Author:** ![viainterativa](https://avatars.discourse-cdn.com/v4/letter/v/c57346/32.png) [@viainterativa](https://community.gravityforms.com/u/viainterativa)\
**Post date:** [October 18, 2018, 2:41pm UTC](https://community.gravityforms.com/t/replacing-the-input-with-a-custom-one-resolved/104/4 "2018-10-18T14:41:27Z")

</div>

In fact, only form fields that are properly e-mail. The input of these fields generates a type text. I need to make this change because one of the company’s system is responsible for capturing the registration of the data in these forms and the field of the email must be with type = “email”, if type = “text” does not work.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [October 18, 2018, 2:43pm UTC](https://community.gravityforms.com/t/replacing-the-input-with-a-custom-one-resolved/104/5 "2018-10-18T14:43:24Z")

</div>

Be sure you have “Output HTML5” set to Yes on the Forms \> Settings page. That will make the Email fields have the type=“email”. Will that work for you?

 ![chrome_2018-10-18_09-43-05](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/4/45349c46ef1ce705e8d938e5f794677ed4d9a73e.png)

---

<div class="post-metadata">

**Author:** ![viainterativa](https://avatars.discourse-cdn.com/v4/letter/v/c57346/32.png) [@viainterativa](https://community.gravityforms.com/u/viainterativa)\
**Post date:** [October 19, 2018, 8:17pm UTC](https://community.gravityforms.com/t/replacing-the-input-with-a-custom-one-resolved/104/6 "2018-10-19T20:17:55Z")

</div>

Thanks a lot for the help, activating HTML5 really solved the problem.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [October 19, 2018, 8:25pm UTC](https://community.gravityforms.com/t/replacing-the-input-with-a-custom-one-resolved/104/7 "2018-10-19T20:25:48Z")

</div>


