We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11970
    • 10 Posts
    Hi,
    I’m trying to create a page, that show eForm only for registered web-users after they login.

    I wrote a snippet, that checks that correct user in logged in and shows a form.
    I tryed to run eForm 2 ways - using runSnippet call and just by inserting [[eForm....
    Both way show me a form, but when I fill and submit it, I see an empty form again.

    Can you help me with an idea, how to do it?
      • 7914
      • 137 Posts
      Is your snippet that checks if a user is logged in or not working properly? I am assuming it is...

      When you fill out your form, does it get processed at all? If so, don’t forget the redirect "&redirectTo=`doc_id`" to send users to a thank you page.
        • 11970
        • 10 Posts
        My snippet is working, I’m sure, because I tested it without eForm. The simple test is to show 2 messages - one for logged user and one for not logged. It’s working!

        The steps are:
        1. check user logged -> show empty eform
        2. user fill data
        3. press submit -> reloading page
        5. check user logged -> eform process data

        Maybe you know how can I check, that eForm get my data? I think it is a problem on step 5. On step 5 it seems like I receive a simple new eForm call.

        I use onBeforeMailSent to preprocess data from the form, but on step 5 I see only new empty form. When I print $_POST before any call of eForm - I see, that data from form in $_POST is present.

        I will try to check eForm with &redirectTo, maybe it will work...

        ;-)
          • 7914
          • 137 Posts
          I think it took me a few tries to get it working properly for me too. (I just have a thick head sometimes)

          Here is what my FormIt call loos like
          [[!FormIt?
             &hooks=`email,redirect,spam`
             &emailTpl=`email_tpl`
             &emailTo=`[email protected]`
             &emailFromName=`My Company <[email protected]>`
             &emailSubject=`Clever Subject Line`
             &redirectTo=`83`
          ]]
          


          I also had some validate stuff in there as well.

          Then for the markup:
          <p>[[+fi.error.error_message]]</p>
          form id="frm_client_survey" action="[[~[[*id]]]]" method="post" />
          <fieldset>
          	<ol>
          		<li><input type="hidden" name="nospam:blank" value="" /></li>
          		
          		<li><span class="error">[[+fi.error.looking_for]]</span>
          		<label for="input">Form Label</label>
          		<input type="text" id="input" name="input" value="[[+fi.input]]" /></li>
          ....
          

          (and so on)

          Hope this helps!
            • 11970
            • 10 Posts
            Thanks, but read my first post - I’m trying to use eFrom only for registered users.