Custom clone page with a required date field cleared out

Trying my best to figure this one out, but hitting major roadblocks. Could be my own ignorance, lack of caffeine, and poor search terms…

We have a custom object where a user fills out a form requesting work to be done by required due date. I built a custom clone page (following the tutorial) for users to request new work with all the same information–EXCEPT, we need them to fill out a new due date.

I followed the tutorial and the field is set to edit and is required, but how do I make it clear out like it would be when first filling the form out? It is a date field and I want it to be blank to force the user to enter a new date. I would be okay (not great, but okay) with it being a pre-set value, like tomorrow. But, clearing out the data and forcing a new date to be picked is the ideal situation I am looking for.

Am I missing some easy step? (Please tell me I am.)

Sarah,

Any fields included in your model on the ‘clone page’ will be copied from the source record.  This is working as designed.

I think your best bet is to add a small Javascript snippet that will run on page load to clear the date field that you want the user to change.

Is this something that you can take on?

Thanks,

Bill

Bill,

Thanks for the response. Yes, all my other clone features are working as designed. We just don’t trust our users to change the date. The snippet path seemed like one that would work, but wasn’t sure if there was another approach. I am NOT hip to writing my own javascript, just mangling existing snippets.

I found this post about clearing a datetime field, but there wasn’t anything I saw that I could appropriate.

I will keep searching and see if I can cobble something together. At least I know this is the right direction.

–Sarah

Sarah,

This should get you what you want.  When you add the JS snippet, make sure it is an ‘Inline’ snippet.  This will make it run on page load.

(function(skuid){ var $ = skuid.$;<br> $(document.body).one('pageload',function(){<br> var myModel = skuid.model.getModel('Task');<br> var row = myModel.getFirstRow();<br>&nbsp; &nbsp; &nbsp; &nbsp; myModel.updateRow(row, {ActivityDate:''});<br> });<br>})(skuid);


Thanks,

Bill

Brilliant, Bill. This worked perfectly. Thanks!

I’m trying to use the inline snippet above but it is not clearing out my field on my clone page. Is there something missing in the JS?


(function(skuid){<br />&nbsp;&nbsp;&nbsp; var $ = skuid&#46;$;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(document&#46;body)&#46;one('pageload',function(){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var myModel = skuid&#46;model&#46;getModel('<i><b>MyModelName</b></i>');<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var row = myModel&#46;getFirstRow();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; myModel&#46;updateRow(row, {<i><b>MyFieldName</b></i><b>:</b>''});<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br />})(skuid);