Jump to:

10845 Posts in 2516 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » UserForms - loaded into other page

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 478 Views
  • borriej
    Avatar
    Community Member
    267 Posts

    UserForms - loaded into other page Link to this post

    Hello,

    I have a reservation form which is on [removedMyUrl]
    Everything is very nicely styled with css, also the custom errors are set.

    Now i have a pageType 'Diensten' where I want to include this form at the bottom of the page.

    So i use:
    Diensten.php

    class Diensten_Controller extends Page_Controller {
       
    function ShowForm(){
          $get = DataObject::get_one('UserDefinedForm');
          return new UserDefinedForm_Controller($get);
       }

    }

    Diensten.ss

    <% control ShowForm %>
    $Form
    <% end_control %>

    See
    [removedMyURL]

    The form shows on all pages, BUT:
    - the custom error messages are the default onces, not the onces i've set
    - the styling of the error message is different

    WHY? and HOW can i fix this?

  • borriej
    Avatar
    Community Member
    267 Posts

    Re: UserForms - loaded into other page Link to this post

    UP! Still need a fix for this
    The validation works more-or-less, but I get the default errors and the datePicker isnt working! The checkbox is required, but it isn't required when the form is loaded through showForm(); this is not my intention.

    Any one? Willr?

  • Martijn
    Avatar
    Community Member
    271 Posts

    Re: UserForms - loaded into other page Link to this post

    you need to block the prototype validation and add the jquery javascript
    see UserDefinedForm_Controller init:

    // block prototype validation
    Validator::set_javascript_validation_handler('none');
          
    // load the jquery
    Requirements::javascript(SAPPHIRE_DIR .'/thirdparty/jquery/jquery.js');
    Requirements::javascript('userforms/thirdparty/jquery-validate/jquery.validate.min.js');

  • borriej
    Avatar
    Community Member
    267 Posts

    Re: UserForms - loaded into other page Link to this post

    works like a charm!! thank you so much!

    478 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.