auto resize a form because of "not you" function

Dagmar_Betz
Level 2

auto resize a form because of "not you" function

hi,

I want to resize a form automatically because of the not-you function. for example, a form for a event registration has got 10 fields (name, address etc.). if the visitor is known at the system, some fields are not visible because they are prefilled (just in the background). so it could be that there are only a little text and a button for registration to the event. in this case there is a lot of space between the button and the page footer.

I want to avoid this empty area. has somebody solved this issue? or do you have any ideas? it would be great.

regards,

dagmar

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: auto resize a form because of "not you" function

I always recommend this script within the Known Lead HTML:

<script>

MktoForms2.whenReady(function(form){

  form.getFormElem()[0].className += ' mktoKnownLead';

});

</script>

Then you can style the form differently depending on whether you're in KL mode or not.

Dagmar_Betz
Level 2

Re: auto resize a form because of "not you" function

hi sanford,

thanks a lot! I will try!

best,

dagmar

Dagmar_Betz
Level 2

Re: auto resize a form because of "not you" function

hi sanford,

thanks, it works for the form and I'm sure we will need that in future too.

but is there a way to have influence to other elements? we need to regulate the height of DIV#mktContent  (on the landingpage).

sorry I explained it wrong in my first post.

do you have an idea for that?

thanks,

dagmar

SanfordWhiteman
Level 10 - Community Moderator

Re: auto resize a form because of "not you" function

Sure, you can add the class all the way up on the body tag if you want:

     document.body.className += ' mktoKnownLead'

Then CSS selector

     BODY.mktoKnownLead DIV#mktContent {}

will select the DIV only when it is on a page that is showing Known Lead HTML.

(And can you please mark as Correct Answer?)