2 Replies Latest reply on Oct 31, 2015 12:58 PM by Sanford Whiteman

    Is there a way to know the dimensions of a form?

    Robb Barrett

      I'd like to have a page that adjusts its height according to the size of the form, including adjustments when fields become visible.  Is there a way to get this information and put it into a page size token?

        • Re: Is there a way to know the dimensions of a form?
          Grégoire Michel

          Hi Robb,


          Unfortunately, this is not possible. But from your question, I gather you are using a free-form template, isn't it ? If this is the case, event though, I am not sure that your could use this token to reformat the page anyway, at least not without some scripting.


          If so, you may want to consider moving to Guided Landing Page Templates (i.e. Responsive design) that would be able to support this "naturally".



          • Re: Is there a way to know the dimensions of a form?
            Sanford Whiteman

            +1 to everything Greg said. 


            The maximum possible height of the form including visibility rules is not computed.  It would be impossible for Marketo to do this on the server, in any case, since they have no idea of what other CSS you're applying to the form.  (Not sure why you'd want to fit to the maximum height, anyway, as your page might like mighty strange with whitespace allocated for fields that aren't rendered.)


            It is possible to read the (probable) width of the form via JavaScript (which could potentially be done before the form is made visible): forms.js makes this easily accessible by applying an element style to the <FORM>. However, the width might also have to be overridden using local styles if it upsets your layout, so you'd actually have to interrogate the current dimensions at runtime.


            If you want complete control over form layout, start with something like my destyled form and then build from there.