Jump to:

10850 Posts in 2517 Topics by 1793 members

All other Modules

SilverStripe Forums » All other Modules » Extending Userforms - tracking users, only allow one attempt

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 283 Views
  • Futureweb
    Avatar
    Community Member
    232 Posts

    Extending Userforms - tracking users, only allow one attempt Link to this post

    Hello,

    I'm using the userforms module ( which is excellent! ) for a membership site. The concept is people create an account, log in, and get given a few questionaires/tests.

    What I need is

    > only allow a user to complete the form one time
    > the site owners need to be able to find a client in the CMS and view the results of forms they've submitted

    ideally it would be nice if I could extend the 'options' tab in the form to have 3 options:
    > allow unlimited submissions | allow one submission | user can return and edit form

    Any suggestins welcome

    Thanks

  • Futureweb
    Avatar
    Community Member
    232 Posts

    Re: Extending Userforms - tracking users, only allow one attempt Link to this post

    Ok, i've got one part working by created this function in page.php

    public function FormSubmittedAlready() {
          $MemberID = Member::currentUser()->ID;
          return DataObject::get('SubmittedForm', "`SubmittedByID` = '$MemberID' and `ParentID` = '$this->ID' ");      
    }

    and then putting this in page.ss

    <% if FormSubmittedAlready %>
    <p>You have already submitted this form</p>
    <% else %>
       $Form
    <% end_if %>

    however, i had to remove $UserDefinedForm from the CMS field, to force the form to default to using the $Form area in the template. this means i've lost the abilty to control where the form is...

    still looking for solutions to the other parts...

    283 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.