Skip to main content

I'm trying to use this button click to store the selections and the text entered in another field and clear out these selections immediately after. I've figured out how to get and move all values, and clearing the all the other fields out wasn't too difficult, but the Date Picker doesn't seem to want to clear out properly.

Any ideas on how to clear this field??

Associated fields:

jsDispositionBy - Choice Dropdown

jsDisposition - Choice Dropdown

jsDispositionDate - Date Picker

jsDispoComm - Multiline (Plain Text)

jsDispositionHist - Multiline (Plain Text)

setDispositionHist() - Save Disposition Button Client Click action

Before:

Before Save Disposition Click

After:

The function works as desired, except for reset of the Date Picker.

Where I found the displayed value of the Date Picker (Using Google Chrome Dev Tools:

Applicable functions:

function setDispositionHist(){
     var dispo = NWF$('#' + jsDisposition).find('option:selected').text();
     var dispoBy = NWF$('#' + jsDispositionBy).find('option:selected').text();
     var dispoDtval = parseDate(NWF$('#' + jsDispositionDate).val(),'mm/dd/yyyy');
     var dispocoTwo = NWF$('#' + jsDispoComm).val();
     var dispoHist = NWF$('#' + jsDispositionHist).val();
     var newdispco = dispo + '
' + dispoBy + '
' + dispoDtval + '
' + dispocoTwo + '
' + dispoHist;
     NWF$('#' + jsDispositionHist).val(newdispco);
     NWF$('#' + jsDispoComm).val('');
     var disBy = NWF$('#' + jsDispositionBy).find('option:selected').val();
     var disParse = NWF.RuntimeFunctions.parseLookup(disBy,true);
     setDispBy(jsDispositionBy,';#**SelectValue**');
     var dispval = NWF$('#' + jsDisposition).find('option:selected').val();
     var dispchs = NWF.RuntimeFunctions.parseLookup(dispval,true);
     setDispChs(jsDisposition,';#**SelectValue**');

function setDispBy(jsDispositionBy, value){
     NWF$(NWF$('#' + jsDispositionBy).siblings('select')B0]).val(NWF.RuntimeFunctions.parseLookup(value, true));
     NWF$('#' + jsDispositionBy).val(value);
}
function setDispChs(jsDisposition, value){
     NWF$(NWF$('#' + jsDisposition).siblings('select')(0]).val(NWF.RuntimeFunctions.parseLookup(value, true));
     NWF$('#' + jsDisposition).val(value);
}

function parseDate(dateString, userFormat){
     var delimiter, theFormat, theDate, month, date, year, dtString;
     userFormat = userFormat || 'mm/dd/yyyy';
     delimiter = /,^dmy]/.exec(userFormat)b0];
     theFormat = userFormat.split(delimiter);
     theDate = dateString.split(delimiter);
     for (var i = 0, len = theDate.length;i < len; i++){
          if (/d/.test(theFormat)){
               date = theDate;
          }
          else if (/m/.test(theFormat)){
               month = parseInt(theDate, 10);
          }
          else if (/y/.test(theFormat)){year = theDate;
          }
          }
          dtString = month + '/' + date +'/' + year;
          return dtString;
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Hi Tim,

I haven't gone through your complete JS, but assuming if everything is working in order if you just need to clear out the DateTime field, you could set the DateTime JS variable with a null JS variable and it should do the trick.

var blankdate = new Date();
blankdate = null;
NWF$('#' + varDate).val(blankdate);

Where varDate is your Date control JS variable.

Regards,

Shrini

please mark the answer as correct if it helps you solve you issue. It helps other community members looking for the same question.


Shrini, you are a genius! Thank you so much for your prompt help!


Reply