Modifying built-in form controls for form module

John Bratteli asked on February 9, 2017 16:13

I'd like to modify the HTML output when certain form controls are selected in Forms->Fields. I'm trying to take advantage of some HTML5 features; for instance, when an editor adds a Email field, I'd like an <input type="email" /> tag on the page, instead of the <input type="text" /> we get now. I'll likely work this into a module at some point. Any suggestions?

Correct Answer

Brenden Kehren answered on February 10, 2017 17:07

John, if Kentico is working on that, I'd not waste your time creating a custom module for it. You can simply clone the controls and add them to Kentico and then simply disable the other controls you cloned and the end user would have no idea what they were "selecting a different control". You'd have to rename the old one to something like "textbox old" or something on that line so you don't use it inadvertently.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on February 9, 2017 16:23

You won't be modifying the "module" it will be a matter of cloning the existing form controls and making the modifications within those cloned form controls. For instance, go into Form Controls, find the email control and click Clone. Then go into your file system under /CMSFormControls/EmailInput.ascx (or whatever your new control is called) and make the necessary changes.

Keep in mind, these changes are coming for v11 later this year.
http://ideas.kentico.com/forums/239189-kentico-product-ideas/suggestions/7161014-add-support-for-html5-input-types

2 votesVote for this answer Mark as a Correct answer

Ilesh Mistry answered on February 9, 2017 17:34 (last edited on February 9, 2017 17:35)

I would agree with Brenden (+1), as cloning the form control will help with this.

Additionally, to Kentico looking to release support for HTML5 soon, you can also look at the Kentico Marketplace for this - http://devnet.kentico.com/marketplace/inline-controls/html5-input-form-control

2 votesVote for this answer Mark as a Correct answer

John Bratteli answered on February 9, 2017 18:11

I didn't know they were working on that for K11. I was hoping to write my own module that would replace the regular form control with the HTML5 version - I'd prefer my users not have to select a different control. I'm thinking now that's isn't going to happen (before K11) without modifying core, which I'm more than a little reluctant to do. Anyway, thanks guys.

0 votesVote for this answer Mark as a Correct answer

Marla Krause answered on May 3, 2017 18:42

FYI... You can also use JavaScript or jQuery to add the type attribute to the form controls in the mean time.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.