Jump to:

11003 Posts in 2735 Topics by 1824 members

All other Modules

SilverStripe Forums » All other Modules » Javascript and UserForms inside other pages

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1129 Views
  • JoshuaLewis
    Community Member
    76 Posts

    Javascript and UserForms inside other pages Link to this post

    Using a method similar to this http://www.silverstripe.org/all-other-modules/show/267822?showPost=293032 I'm displaying my UserForm inside of a separate page.

    It shows up and processes fine but the normal javascript requirements of jQuery and jQuery-validate aren't showing up and are instead being replaced with prototype.js, behaviour.js, and others.

    Now I assume that the way I'm calling up the form bypasses UserDefinedForm->init(); and prevents it from applying the normal requirements. Including them manually is easy enough but what I haven't been able to figure out is where the other requirements are coming from.

    Does anyone have any ideas on why this problem is happening and how it can be fixed?

    The bits of code working with the form can be found here : http://pastie.org/1217591
    Edit : The page I'm working with is here http://cv.lewiswebdesign.com/

  • CHD
    Community Member
    218 Posts

    Re: Javascript and UserForms inside other pages Link to this post

    you can block the usual prototype validators by adding this to your page.php in mysite/code/

    public function init() {
          // block prototype validation
          // load the jquery
          Requirements::javascript(SAPPHIRE_DIR .'/thirdparty/jquery/jquery.js');

    that will make the userforms work normally in other pages when included.

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.