Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

DatePicker not displaying in Custom Form


Go to End


5 Posts   1468 Views

Avatar
K_T

Community Member, 8 Posts

28 June 2012 at 12:18am

Edited: 28/06/2012 12:20am

Hi All,

I am having a form that contains a DateField along with some Select and Textbox.
I created the form using a public function MyForm(){ } and it worked great and i am getting the form in the Frontend exactly like i want but i have to decorate it a bit so i tried to go for the Custom Form to make layout as per requirement.Now the problem is it is displaying all fields correct except that DateField the HTML generated for it show it as a plain textbox

<input type="text" value="" name="dt" id="SearchForm_dtfield" class="text"> when i tried displaying it using $dataFieldByName(dtfield)

Any Idea why is it behaving so..??

Thanks
K_T

Avatar
K_T

Community Member, 8 Posts

29 June 2012 at 1:19am

Hi Guys,

AnyOne Please . . has anycome used DateField with Custom Form . . ??

Thanks

Avatar
Banana

Community Member, 18 Posts

29 June 2012 at 10:50pm

You can create a new class, extending the dateField class. In this calls overwrite the Field method to create your wanted HTML code.

Avatar
Willr

Forum Moderator, 5523 Posts

30 June 2012 at 12:49pm

Use $dataFieldByName(dtfield).FieldHolder

Avatar
K_T

Community Member, 8 Posts

4 July 2012 at 11:32pm

Thanks WillR It Worked..