Embed form inside iframe externally

Support MB Frontend Submission Embed form inside iframe externallyResolved

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #36401
    Nicholas CoxNicholas Cox
    Participant

    Hi

    I was wondering, is it possible to embed a front end form inside a iframe? so i can display the form on a subdomain oage? or will i need to create this functionality myself? i basically want to output the form externally but on the same domain name.

    thanks

    #36420
    Long NguyenLong Nguyen
    Moderator

    Hi Nick,

    Yes, it is possible to embed a frontend form in an iframe tag. You can also refer to this documentation for more information https://docs.metabox.io/extensions/mb-frontend-submission/#embedding-forms-on-other-sites-via-iframe

    #36426
    Nicholas CoxNicholas Cox
    Participant

    Ok thanks. There is no example of the iframe element so i assume that the form has to be outputted on a webpage and embed the whole webpage inside the iframe?

    Is there a way just to output the form only inside a iframe with required css/js?

    Thanks

    #36442
    Long NguyenLong Nguyen
    Moderator

    Hi,

    iframe tag is used to embed the HTML document to display the content on a page. I do not see a way to embed a shortcode only with this tag. Or you can try to create a blank page with the frontend form only.

    Please read more on the documentation https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe

    #36447
    Nicholas CoxNicholas Cox
    Participant

    Hi

    sorry i think i did not explain myself clearly. I do not understand this guide https://docs.metabox.io/extensions/mb-frontend-submission/#embedding-forms-on-other-sites-via-iframe as i thought there would be an example of a iframe tag pointing to a page with an embedded form?

    I thought about creating a blank page with the front end form, but if i try to include the shortcode in a php file it renders the form but with no js/css.
    e.g.

    require_once( '../../../../../../wp-load.php' );
    echo do_shortcode('[mb_frontend_form id="dc-product-comments" submit_button="Submit" ajax="true"]');

    Or event if I create a hidden wordpress page and include the front end form shortcode then i end up outputting header/footer content too, which i do not want.

    #36471
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Most scripts (CSS, JS) in a theme or a plugin are registered by the function wp_enqueue_script() and they are loaded in the header or footer of the page. So if you remove the header or footer, the script files could not be loaded.
    I think you can try to use the CSS code to hide the header and footer instead of excluding them from loading.

    #38239
    Nicholas CoxNicholas Cox
    Participant

    ok thanks, i have managed to sort it out with CSS to hide it.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.