This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:projekt:jsfundgrube:datepicker_format [2018/01/11 08:25] Julian Le created |
en:projekt:jsfundgrube:datepicker_format [2021/07/01 09:52] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | FIXME **This page is not fully translated, yet. Please help completing the translation.** \\ | + | <note tip>The entry about the datepicker can be found [[en:software:tim:smartform_basics#datepicker_calender|here]].</note> |
- | //(remove this paragraph once the translation is finished)// | + | |
- | <note tip>Den Eintrag über den [[:software:tim:smartform_basics#datepicker_kalender|Datepicker]] kann [[:software:tim:smartform_basics#datepicker_kalender|hier]] gefunden werden.</note> | + | ======Changing the date's format in the datepicker====== |
- | ====== Datumsformat im Datepicker ändern ====== | + | With this javascript function you can change the date's format in your own datepicker |
- | Mit dieser Javascript Funktion kann mit eigenen Datepickern das Format des Datums geändert werden | + | * e.g. 01.01.2017 |
+ | * e.g. 01-01-2017 | ||
- | * z.B. 01.01.2013 | + | This is the format, which is used, when storing the values in the TIM database. This way you get a pretty format for [[en:software:tim:actionhandler:wordtemplatehandler|WordTemplates]], [[en:software:tim:mailnode|Mailnodes] etc. |
- | * z.B. 01-01-2013 | + | |
- | Dass ist das Format in dem die Werte anschließend in die T!M Datenbank geschrieben werden. So erhält man eine schöne formatierung für [[:software:tim:actionhandler:wordtemplatehandler|WordTemplates]], [[:software:tim:mailnode|Mailnodes]] etc. | + | Therefor a new datepicker has to be implemented in the custom.js, which overrides the one in TIM. |
- | Hierfür muss ein neuer Datepicker in der Custom.js angelegt werden, welcher die T!M eigene überschreibt. | + | In the [[en:software:tim:smartform|Smartform]] we need, like with the normal datepicker, input field with a class. In this example the class **datefield** is used. |
- | + | ||
- | In der [[:software:tim:smartform|Smartform]] brauchen wir hier, wie auch beim normalen Datepicker, Inputfelder mit einer Klasse. In meinem Beispiel hier habe ich die Klasse datefield gewählt. | + | |
<code> | <code> | ||
<form initMethod="initMyDateField"> | <form initMethod="initMyDateField"> | ||
- | <input type="text" name="myDateField" id="myDateField" class="datefield"/> Datum | + | <input type="text" name="myDateField" id="myDateField" class="datefield"/> Date |
</form> | </form> | ||
</code> | </code> | ||
- | jQuery wird hier benötigt und muss eingebunden werden! | + | jQuery is required here and must be imported! |
<code> | <code> | ||
Line 29: | Line 26: | ||
</code> | </code> | ||
- | In der Customdatei wird nun in der initMyDateField (frei wählbar) der Datepicker initialisiert. | + | In the custom file the datepicker is now being initialized in the function initMyDateField (name is freely selectable) |
<code> | <code> | ||
Line 38: | Line 35: | ||
</code> | </code> | ||
- | Dem Datepicker können verschiedene regionale Formatierungen mitgegeben werden. In diesem Beispiel "de" was dann zu folgendem führt: 31.07.2013 | + | The datepicker can be given different regional formats. In this example "de" was given, which leads to: 31.07.2013 |
- | Es sind natürlich noch weitere Formatierungsarten möglich, bishin zur Benennung der Wochentage und Monate. Hierfür lohnt sich ein Blick in die jQuery API für Datepicker ([[http://api.jqueryui.com/datepicker/|http://api.jqueryui.com/datepicker/]]). | + | There are of course further formats available, all the way to naming the weekdays and months. Therefor you can look in the jQuery API for datepicker |
+ | ([[http://api.jqueryui.com/datepicker/|http://api.jqueryui.com/datepicker/]]). | ||