Add a CSS class to MktoForm field | Community
Skip to main content
Community Manager
Jun 20, 2017 5:57 PM UTC
Solved

Add a CSS class to MktoForm field

Related to this thread, I want to add an autocomplete feature to one of the fields to avoid a long select list.  I found this JS that will do the job... Awesomplete: Ultra lightweight, highly customizable, simple autocomplete, by Lea Verou

The trick is to add a class to the field (<input class="awesomplete" ...) but i don't see how to do that.  Any ideas?

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Jun 20, 2017 6:02 PM UTC

Awesomplete has multiple methods of binding data lists to inputs.

The CSS class is the declarative method, and that isn't the best choice for forms libraries like Marketo's, which inject forms asynchronously into the page.

Instead, use the programmatic method, as shown here: MktoForms2 :: Awesomplete

6 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Jun 20, 2017 6:02 PM UTC

Awesomplete has multiple methods of binding data lists to inputs.

The CSS class is the declarative method, and that isn't the best choice for forms libraries like Marketo's, which inject forms asynchronously into the page.

Instead, use the programmatic method, as shown here: MktoForms2 :: Awesomplete

Translate
Community Manager
Jun 20, 2017 6:45 PM UTC

Perfect! 

Just what I needed.  Thanks!

Translate
Community Manager
Aug 15, 2017 5:20 PM UTC

Is there a way to change the code and datalist, so I the user can pick their Full Name and Awesomplete will populate their First name, Last name, Email address, and Phone into hidden fields?

Translate