Smart Editor Defualt datetime Field to now()

925
1
08-20-2019 03:34 PM
NicholasConnolly
New Contributor II

I have a built a Web App that uses the Smart Editor widget. The widget mostly meets my needs. However, I would like to set a datetime field to default to now(). Is it possible to default the datetime field to now() within Web AppBuilder?

datetime now()

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

Nicholas,

   In the Widget.js find this code and update (line 3 is whats changed):

                if (presetValueNode.declaredClass === "dijit.form.DateTextBox" ||
                  presetValueNode.declaredClass === "dijit.form.TimeTextBox") {
                  value = (value === "" || value === null) ? new Date().toISOString() : new Date(value);
                }

This also requires you to have the attribute action for the date field set to preset and then no preset value specified in the widgets settings.

0 Kudos