Jump to:

22977 Posts in 11729 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » How to make Date Picker in frontend work

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
Go to End
Author Topic: 1787 Views
  • _Jam_
    Avatar
    Community Member
    9 Posts

    How to make Date Picker in frontend work Link to this post

    Hi,

    Sorry if this might sound stupid but I have been trying to make datepicker in my custom form for my site. I have been searching the net already but I cant seem to find any guide on how to make this work. Please help me on this cause im new to silverstripe. Thanks in advance.

    John

  • mmh
    Avatar
    Community Member
    24 Posts

    Re: How to make Date Picker in frontend work Link to this post

    Try:

    $dateField = new DateField('DateField', 'DateField);
    $dateField->setConfig('showcalendar', true);

  • _Jam_
    Avatar
    Community Member
    9 Posts

    Re: How to make Date Picker in frontend work Link to this post

    Hi mmh, This is my form function but there something that seems to be lacking cause i don't get any errors but the datepicker is still not working

    function Form() {

    $datefield = new DateField( "Birthday" );
    $datefield->setConfig( "showcalendar", true );

          $form = new Form($this, "Form", new FieldSet(

             // List your fields here
             new TextField("FirstName", "First name"),
             new TextField("LastName"),
    new TextField("Gender"),
    $datefield,
             new EmailField("Email", "Email address"),
    new PasswordField("Password", "Password"),
    new PasswordField("Password2", "Retype Password"),
    new TextField("BusinessName","Business Name"),
    new TextareaField("BusinessLocation", "Business Address")

          ), new FieldSet(

             // List the action buttons here
             new FormAction("SignupAction", "Submit","","","button-sign-up")

          ), new RequiredFields( "Email", "FirstName", "Surname" )
    );
    $protector = SpamProtectorManager::update_form($form, 'Captcha');
    return $form;
       }

  • mmh
    Avatar
    Community Member
    24 Posts

    Re: How to make Date Picker in frontend work Link to this post

    Hi nhoj,

    I've tested the code in one blank site - everything works as expected (in SS 2.4.4)...

    Attached Files
  • _Jam_
    Avatar
    Community Member
    9 Posts

    Re: How to make Date Picker in frontend work Link to this post

    It seems to be a css issue because its working when I switch my theme to blackcandy :/

  • _Jam_
    Avatar
    Community Member
    9 Posts

    Re: How to make Date Picker in frontend work Link to this post

    I got it working now. there was problem with my css

    Thanks mmh

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