Jump to:

23489 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Userforms :: validation bug

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1 2 3
Go to End
Author Topic: 5503 Views
  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: Userforms :: validation bug Link to this post

    Hmmm, from here I don't think I can provide much more insight. I think you just need to tweak the form require values, but UserForms are not my strength. I think you should try opening another question in the Modules or Forms forum where someone with more specialty can assist.

  • Junglefish
    Avatar
    Community Member
    104 Posts

    Re: Userforms :: validation bug Link to this post

    Will do. I've reposted the issue to the All Other Modules area.

    Thanks for your help.

    jf/

  • Junglefish
    Avatar
    Community Member
    104 Posts

    Re: Userforms :: validation bug Link to this post

    Okay, I know *what* it is, but I don't know how to fix it. It would appear that UserForms is clashing with Event_Calendar.

    I have the Event_Calendar module installed and have created a GlobalCalendarWidget that makes the calendar widget appear in the sidebar on all my pages.

    In mysite/code/page.php I have this:

    function GlobalCalendarWidget() {
       $calendarPage = DataObject::get_one("Calendar");
       return new CalendarWidget($calendarPage);
    }

    and in my [theme]/templates/Includes/RightBar.ss template I have this:

    $GlobalCalendarWidget

    If I remove them both, the UserForms error goes away.

    With the code commented out, there are three JS scripts in the source:

    <script type="text/javascript" src="http://localhost/SilverStripe/jsparty/jquery/jquery.js?m=1227671444"></script>
    <script type="text/javascript" src="http://localhost/SilverStripe/jsparty/jquery/plugins/validate/jquery.validate.min.js?m=1210129496"></script>
    <script type="text/javascript" src="http://localhost/SilverStripe/mysite/javascript/menu.js?m=1239714101"></script>

    But when Event_Calendar is on the page, there are 6 additional scripts:

    <script type="text/javascript" src="http://localhost/SilverStripe/event_calendar/javascript/locale/date_en.js?m=1247672972"></script>
    <script type="text/javascript" src="http://localhost/SilverStripe/event_calendar/javascript/jquery-1.2.6.min.js?m=1237479890"></script>
    <script type="text/javascript" src="http://localhost/SilverStripe/event_calendar/javascript/jquery.date.js?m=1247672932"></script>
    <script type="text/javascript" src="http://localhost/SilverStripe/event_calendar/javascript/jquery.datePicker.js?m=1237479890"></script>
    <script type="text/javascript" src="http://localhost/SilverStripe/event_calendar/javascript/calendar_core.js?m=1238950836"></script>
    <script type="text/javascript" src="http://localhost/SilverStripe/event_calendar/javascript/calendar_widget.js?m=1237479890"></script>

    So, something in the Event_Calendar scripts is 'clashing' with something in the first three scripts, but.... hell, where do I start looking..?

    jf/

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Userforms :: validation bug Link to this post

    So, something in the Event_Calendar scripts is 'clashing' with something in the first three scripts, but.... hell, where do I start looking..?

    Have a look in the code in the event calendar module for the Requirements() it is including its own version of jquery where as userforms (and event_calendar for that matter) should be including the one in jsparty. Edit the link to use the one in jsparty and see if that fixes it (or it could be a plugin conflicting)

  • Junglefish
    Avatar
    Community Member
    104 Posts

    Re: Userforms :: validation bug Link to this post

    Hi Willr

    Thanks for your suggestions, however, things are still not going well Here's what I've tried...

    a) In event_calendar/code/CalendarEvent.php I find these three lines in the init() function:

          Requirements::css('event_calendar/css/calendar.css');
          Requirements::javascript('event_calendar/javascript/jquery-1.2.6.min.js');
          Requirements::javascript('event_calendar/javascript/calendar_core.js');

    If I simply comment them out, the calendar continues to work fine, but I still get the same conflict error with UserForms.

    b) In event_calendar/templates/CalendarWidget.ss I find this line:

          <% require javascript(event_calendar/javascript/jquery-1.2.6.min.js) %>

    If I replace it with:

          <% require javascript(jsparty/jquery/jquery.js?) %>

    the calendar still continues to work fine, but I still get the same conflict error with UserForms.

    If I remove it altogether, the calendar widget no longer loads and I get the following errors:

          "jQuery is not defined
           http://localhost/SilverStripe/event_calendar/javascript/jquery.datePicker.js?m=1237479890"

          "jQuery is not defined
           http://localhost/SilverStripe/event_calendar/javascript/calendar_widget.js?m=1237479890"

    Coflicting plugins?? If so, where do I look next?

    jf/

  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: Userforms :: validation bug Link to this post

    As Will noted above SS includes some versions of jQuery core/plugins that have been modified to remove use of the $ in order to avoid conflicts with Behavior/Prototype (used in UserForms).

    It does not appear that the Event_Calendar module does this, thus it will always be broken when loading both modules at the same time.

    You can try fixing the jQuery libs in Event_Calendar yourself by finding and replacing $ with jQuery, saving as a new file, and useing Requirements:: to include that one instead. BE ADVISED YOU RUN A VERY HIGH RISK OF BREAKING THE jQuery PLUGINS. I have done something similar before and it does work: http://open.silverstripe.com/ticket/4555

    Your other options are wait for 2.4 when all JS should be refactored into jQuery exclusively or try another set of modules to do what you are trying to do (or code the forms yourself).

  • Junglefish
    Avatar
    Community Member
    104 Posts

    Re: Userforms :: validation bug Link to this post

    @dalesaurus

    Thanks for the info, *and* the warning. When do you think 2.4 might be ready for release?

    jf/

  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: Userforms :: validation bug Link to this post

    No date set yet, but the last estimate I heard was ~4-6mo.

    http://open.silverstripe.com/roadmap

    Not idea in your situation, though...

    5503 Views
Page: 1 2 3
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.