Can we get form 2.0 embeds without inline styling and CSS? | Community
Skip to main content
February 19, 2014
Question

Can we get form 2.0 embeds without inline styling and CSS?

  • February 19, 2014
  • 4 replies
  • 1245 views
Our websites have thier own CSS for doing form styling, we'd like to use the new dynamic form embed code from Marketo without any theme or inline styling so that we can take advantage of being able to change fields using Marketo.

Can you make this an option? 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

February 19, 2014
Yes, inline styling is painful ;(
March 6, 2014
+1

I wholeheartedly agree, but also for forms within Marketo pages (I believe the form HTML is the same either way based on the 'style' you choose when creating the form). I'm currently using jQuery to remove the inline style attributes when the page loads. However, if there is even a little hiccup this blows up the forms. VERY frustrating!

My next step is to try and overwrite the styles with CSS (using !important) to see if that works instead. I've included the jQuery we're using to strip out the code, but use at your own risk as the way the forms are loaded in could prevent the jQuery from running properly (we think it's a timing issue).

 
 
  <script>
    // use no conflict mode for jQuery
    var $ = jQuery.noConflict();
    $(document).ready(function() {
 
      // Remove Marketo form css (why can't we just disable this? So frustrating!)
      $('#mktoForms2ThemeStyle').remove();
      $('#mktoForms2BaseStyle').remove();
 
      // Strip out inline styling (seriously, why do we even have to do this?!)
      $('.mktoHasWidth').each(function() {
        $('.mktoHasWidth').removeAttr("style");
      });
      $('.mktoOffset').each(function() {
        $('.mktoOffset').removeAttr("style");
      });
      $('.mktoNative').each(function() {
        $('.mktoNative').removeAttr("style");
      });
      $('.mktoFormCol').each(function() {
        $('.mktoFormCol').removeAttr("style");
      });
    });
  </script>

Hopefully this helps someone out. Would love to see other's thoughts on this. Together we CAN overcome poorly provided forms!
May 17, 2014
Super Helpful. Thanks Heath
July 9, 2014
Agreed... So frustrating!