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?
Nicholas,
In the Widget.js find this code and update (line 3 is whats changed):
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>presetValueNode<SPAN class="punctuation token">.</SPAN>declaredClass <SPAN class="operator token">===</SPAN> <SPAN class="string token">"dijit.form.DateTextBox"</SPAN> <SPAN class="operator token">||</SPAN> presetValueNode<SPAN class="punctuation token">.</SPAN>declaredClass <SPAN class="operator token">===</SPAN> <SPAN class="string token">"dijit.form.TimeTextBox"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> value <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">(</SPAN>value <SPAN class="operator token">===</SPAN> <SPAN class="string token">""</SPAN> <SPAN class="operator token">||</SPAN> value <SPAN class="operator token">===</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">?</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Date</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">toISOString</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Date</SPAN><SPAN class="punctuation token">(</SPAN>value<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
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.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.