Grails Date Property Editor

前端 未结 3 1459
心在旅途
心在旅途 2021-02-11 07:48

i\'m using the jQuery UI datepicker instead of the , which is changing the selected date in a textbox. Now I want to save this neatly back into

3条回答
  •  别那么骄傲
    2021-02-11 08:50

    I have a created a simple grails custom tag to use the jQuery UI datepicker. It's characteristics are as follows:

    1. It creates three hidden input fields dateField_day, dateField_month, dateField_year

    2. It's responsible for populating these hidden input fields when a date has been selected from the calendar.

    3. Supports having multiple date fields without any conflict.

    It's prerequisites are as follows:

    1. You have to have jquery installed and configured properly in your app structure. That is all the js, css, and themes

    The taglib code is as follows:

    class JqueryDatePickerTagLib {
    

    def jqDatePicker = {attrs, body -> def out = out def name = attrs.name def id = attrs.id ?: name

    //Create date text field and supporting hidden text fields need by grails
    out.println ""
    out.println ""
    out.println ""
    out.println ""
    
    //Code to parse selected date into hidden fields required by grails
    out.println ""
    

    } }

    The gsp code is as follows:

    
    

    You can find the full article at: My Blog

提交回复
热议问题