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.

General Questions /

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

DatePicker not displaying in Custom Form


Reply


5 Posts   581 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, 5513 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..