Jump to:

2012 Posts in 1438 Topics by 621 members

Form Questions

SilverStripe Forums » Form Questions » Validation of TimeField not working

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

Page: 1
Go to End
Author Topic: 1583 Views
  • vancouverWill
    Community Member
    121 Posts

    Validation of TimeField not working Link to this post


    Not sure if I have a bug in my Silver Stripe version but I have tried for several hours to get javascript validation working on a timefield element

    my current setup within the form is

    new TimeField($name = "guests_arriving_at", $title = "Guests arriving at", $value="00:00",$timeformat="G:i"),

    every other validation is working, the form submits and the email is sent.
    For example I have the similar field

    new DateField($name = "event_date", $title = "Date of Event<span class='red'>*</span>, (DD/MM/YYYY)"),

    working fine and javascript validates properly and I get the message "Please fill out "Date of Event*, (DD/MM/YYYY)", it is required."
    if the date is not correctly entered. I used this code to look into the silverstripe sapphire directory and found that within datefield.php and other *field.php files there is a jsValidation function which gets put just below the header of the page with the form on and is called when the form is sent. However there is no jsValidation file within timefield.php as well as some other more general fields such as textfield.php.

    Can anyway explain a way to validate the time input in silverstripe without starting from scratch with a fresh validation framework.

    Thanks in advance.


  • vancouverWill
    Community Member
    121 Posts

    Re: Validation of TimeField not working Link to this post

    No one got any tips? This seems like a bug if the timefield doesn't have any validation at all.....

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.