3

WFFM has a date picker with default value in it, i want to make form that didn't display any values when load for the first time. Im thinking about making the val('') in custom script:

$scw(document).ready(function(){
    $scw("#Vg-0a47Mo0irbuy6Osdada_Sections_0__Fields_6__Value").val('');
});

But if i clicked submit and there is still other field error, it erase the value of date picker.

Any solution?

0

The default value of the date picker field is set in the Text property. The easiest way to set the default value to be an empty string is to manually add an empty <Text></Text> parameter in the Parameters field of your date picker form field item, in Sitecore:

enter image description here

| improve this answer | |
  • fyi im using WFFM 8.0, Ive tried your solution, but the default value didnt change into empty string instead it changed to current date. Thanks – Vsn Mar 13 '17 at 2:59
  • I tested it only using a WFFM WebForms form, not for MVC. I am glad you found a better solution. – Alessandro Faniuolo Mar 13 '17 at 9:43
0

Lol i finally found a way. If you didnt want to make custom field and you are sure that your datepicker default value will be empty on all your WFFM form. The easiest way is to changed it in datepickerfield.cshtml by editing:

 @Html.TextBox("Value", currentDate.ToString(Model.DateFormat), new { @readonly = "", @class = "field-datepicker" })

to:

 @Html.TextBox("Value", null, new { @readonly = "", @class = "field-datepicker" })
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.