1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Form Submit for registered users only

Discussion in 'Styling and Customization Questions' started by ibaker, Oct 12, 2012.

  1. ibaker

    ibaker Well-Known Member

    I have a form in a block on my side bar that I want to have it displayed to everyone however I only want the "Submit" of the form to work for registered users. If a guest clicks the submit button, I want it to go to the Register/Login page...as an incentive to get guests to register.

    The submit code is:
    Code:
    <input type="submit" value="Submit">
    Can anyone tell me how to do it...thanks
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    What is the form action? You can assert user status in your controller if it submits to a XenForo page. At least that's how it would be done in terms of XenForo code. Or you can use a template condition to only show the submit button for registered users:

    Code:
    <xen:if is="{$visitor.user_id}">
    
    </xen:if>
    
     
  3. ibaker

    ibaker Well-Known Member

    Thanks Jake but hiding the submit button I don't think would give the desired impact i.e. get a Guest to register. The form code is:
    Code:
    <div class="section" align="center">
        <form method="get" action="./pages/planner_results.php" target="planner_results" id="table1" onsubmit="window.open('about:blank','planner_results','width=980,toolbar=yes,scrollbars=yes')">
            <input type="hidden" name="pass" value="64358999" />
            <div style="font-style:italic;">(Straight line distance)</div>   
     
            <div>
                <label style="width:250px;">Identifier for Starting Airport:</label>
                <input name="airport1" size="14" type="text" />
            </div>
       
            <div>
                <label style="width:250px;">Identifier for Destination Airport:</label>
                <input name="airport2" size="14" type="text" />
            </div>
       
            <div>
                <input type="submit" value="Submit">
                <input type="reset" value="Reset">
            </div>
        </form>
    </div>
    And the form looks like:
    1.jpg
     

Share This Page