Skip to main content
Nintex Community Menu Bar

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

  • February 15, 2019
  • 3 replies
  • 16 views

Forum|alt.badge.img+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

Forum|alt.badge.img+14
  • Scholar
  • February 15, 2019

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 


Forum|alt.badge.img+1
  • Author
  • February 16, 2019

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!

 


Forum|alt.badge.img+14
  • Scholar
  • February 18, 2019

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')));