Validation on Date only control that setted value via JS not works

  • 15 February 2019
  • 3 replies
  • 0 views

Badge +1

If you put a Date/Time control that is "Date Only", on a form, and set its value via this code:

 

NWF$(function(){
	NWF$("#" + d3).val("01/01/2016");
});

Then add a validation rule on this control to prevent a blank date:

 

 

isNullOrEmpty({Self})

the validation rule will not undrestand its value, and show validation error message.

 

Now, if you set "Date Only" drop down to "No" on contorl settings dialog, this problem does not occure.

Why?


3 replies

Userlevel 5
Badge +14

what env do you experience this in?

I can not reproduce it on my end (NF2013 v2.11.5.0)

 

anyway, it would be better to set control's value(s) within RegisterAfterReady event.

see - https://community.nintex.com/t5/Nintex-for-SharePoint/JavaScript-events-in-Nintex-Forms/m-p/83914 

Badge +1

Nintex Forms 2013 ( 2.11.4.0 )

Use "RegisterAfterReqady Event" will not resolve my problem.

Becaus my orginal problem is that:

Setting Date Only control's value via JS, will not affect in IsNullOrEmpty function!

 

Userlevel 5
Badge +14

have you checked you're not getting errors reported on developer console?

 

 

can you post how does following evaluates on developer console for both DateOnly and Date&Time scenarios?

 

NWF.FormFiller.Functions.GetValue(NWF$("#" + d3).attr('formcontrolid'));
NWF.RuntimeFunctions.isNullOrEmpty(NWF.FormFiller.Functions.GetValue(NWF$("#" + d3).attr('formcontrolid')));

Reply