Developer forum

Forum » Feature requests » Forms for editors - feature: Date Selector

Forms for editors - feature: Date Selector

Erik Hawaleschka Madsen
Reply

Hi DW, I need the feature date/mm/year selector in some form in the forms for editors. See attached "older" form that i am trying to recreate in forms for editors.

Dundex_dateselector_feature_request.png

Replies

 
Rasmus Andersen
Reply

Hi Erik, 

Look at my feature request from yesterday, I am suggesting DW to add HTML5 type attribute to fields. This would allow you to enter date and you would get an HTML5 datepicker. 

If you would like some custom datepicker, you would be able to implement it using code as (this is not working code, DW currently has no "Field.TypeAttribute" tag):

@GetString("Form.FormStart")
@GetString("Form.SystemFields")

@foreach (var field in GetLoop("Fields"))
{
    switch (field.GetString("Field.Type"))
    {

        case "Text":
            <legend>@field.GetString("Field.Name")</legend>

            break;

  	case "TextInput":
            if (field.GetString("Field.TypeAttribute").Equals("date")) 
	    {
	        // Implement you own datepicker using values from the field object here
	    }
	    else {
                @field.GetString("Field.Control")
            }

            break;
    }
}

@GetString("Form.FormEnd")

This seems to be the most flexible way to support future input types.

 

 
Nicolai Høeg Pedersen
Reply

@Rasmus - spot on, and you get the html 5 Datetime control in 8.8 - BUT it is not supported by all browsers yet... So your approach of adding a custom datepicker would still be required.