• Resolved egornmore

    (@egornmore)


    Hello,
    I am getting AMP validation error – “The tag amp-state may not appear as a descendant of tag div” on any wpform. I am using WP Forms Light version.
    Validation Error Screenshot: https://ibb.co/TvpyYM4

    • This topic was modified 3 years, 1 month ago by egornmore.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter egornmore

    (@egornmore)

    The validation error occurs if the wp forms shortcode is in the <amp-mega-menu> component.

    Thread Starter egornmore

    (@egornmore)

    I apologize for opening multiple threads.
    I removed the following part in “class-frontend.php”:

    if ( wpforms_is_amp() ) {
    
      $state = array(
        'submitting' => false,
      );
    
      printf(
        '<amp-state id="%s"><script type="application/json">%s</script></amp-state>',
        $this->get_form_amp_state_id( $form_id ),
        wp_json_encode( $state )
      );
    
    }

    Will my wpform work without those lines? And if not, can I add amp-state after closing <amp-mega-menu> manually as static?

    • This reply was modified 3 years, 1 month ago by egornmore.
    • This reply was modified 3 years, 1 month ago by egornmore.
    • This reply was modified 3 years, 1 month ago by egornmore.
    • This reply was modified 3 years, 1 month ago by egornmore.

    Hello @egornmore,

    Thanks for writing in.

    When you get the chance, can you please let us know which AMP plugin are you using? Currently, WPForms Lite should work with the official Google AMP plugin for WordPress.

    Thanks!

    Thread Starter egornmore

    (@egornmore)

    Hello @jadealombro,
    I am using the official Google AMP plugin By AMP Project Contributors.

    Jade Alombro

    (@jadealombro)

    Hello @egornmore,

    Thanks for confirming.

    While it workaround you took solved the issue, it isn’t something we recommend since editing the core files of any plugin would get wiped out when you upgrade the plugin version.

    But based on the situation you described, did you get any chance if a form element can be placed inside <amp-mega-menu> as it might be more recommended to place forms inside the <amp-sidebar>.

    I might also help if you get in touch with the official Google AMP plugin support for this as this should be something they can confirm.

    Thank you.

    Jade Alombro

    (@jadealombro)

    Hi @egornmore,

    We haven’t heard back from you in about a week, so I’m going to go ahead and close this thread for now. But if you’d like us to assist further, please feel welcome to continue the conversation.

    Thanks!

    Thread Starter egornmore

    (@egornmore)

    Hi @jadealombro

    I’ll try to play around and use <amp-sidebar> instead.

    Thanks for your time!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘AMP validation error’ is closed to new replies.