Jump to content
Pete Foulkes

Forced form completion before advancing

Recommended Posts

On a 'public on the web' Frog site, I was wondering if there was any way a form could be placed on the homepage that the user must complete before other content is revealed? We're doing our virtual open evening as a public site on Frog but we also want to collect visitor data such as parent name, child name, email address etc. 

Could it be possible with some code that when they hit 'Submit' on the form, it either reveals hidden pages or loads another public Frog site?

 

Link to post
Share on other sites

This is a tricky one, because Forms can take a while to load in, generally after the HTML widget.  I've had to play around with this on your Frog, search for a site called "Form-based next button"

You'll find two pages, one with a form and one called hidden page.  I used a text widget to get the page link, then used Inspect to copy the href code.

<div style="display: none;" class="pageLink">
<a alt="/frogtrade/form_based_next_button/hidden_page/" data-page-link-cke="/frogtrade/form_based_next_button/hidden_page/" data-cke-saved-href="#" href="#">hidden page</a>
</div>

<script>
    
setTimeout(function(){  
    console.log('ready');
    $('.btn-success').on( "click", function() {
        console.log('getting here');
        var pageLink = $('.pageLink');
        pageLink.show();
    }.bind(this));

}, 5000);
</script>

What is happening here is that the page link is placed inside a DIV, but the style tag hides that DIV from view

Then in the script section, a javascript timer runs, waiting 5 seconds (5000 miliseconds).  After this, the page is scanned for the form's submit button ( it has a class of 'btn-success'.   Once the script knows that button exists, it waits for it to be clicked and then makes the DIV, with the class 'pageLink' visible.  Quite a bit of dressing up needed, but it should work for you.

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...