Solved

Date field default value calculated shows blank in Nintex Form (works non-nintex)


Badge +3

When using the "Calculated Value" option in a SharePoint list on a Date Field, it shows as blank in a Nintex form, but shows correctly in the default SharePoint form.

 

Example 

Column "date2":

Column Settings

SP form: 

Sp form

Same list, Nintex Form: 
Nintex form

 

Please advise!

icon

Best answer by aaron_labiosa 8 March 2017, 21:55

View original

12 replies

Userlevel 7
Badge +17

I guess Nintex is not using the fields default values. Bit you can set a rule on form load to set value of your field using inline function

Regards,

Tomasz

Badge +3

Can you step me how to do that? It's my understanding that inline functions are not a thing in the Office 365 version. 

Userlevel 7
Badge +10

The other way to do it would be via a bit of JavaScript:

var date = new Date();  

date.setDate(date.getDate() + 7);  

var control = NWF$("#"+ mydatecalccontrol);   if(control.val() == ""){     control.val(date.getDate() + "/" + date.getMonth() + "/" + date.getFullYear()); }

Userlevel 7
Badge +10

You would just drop that javascript in the form settings pane:

Userlevel 7
Badge +17

Aaron idea is good as well

BTW: inline functions are present in Nintex Forms for O365. Indeed they're not available for Workflows (hopefully) yet

Badge +3

First off, thank you for taking the time to help me with this.

See how, in your screenshot, the date showing is "15/2/2017"

That is not a date format that the form can accept. (and even if it were European format, it wouldn't be 7 days from the "today" date.).

Thoughts?

(Note: I understand how to re-order the numbers, but I still can't figure out why it's jumping back to February (2))

-------------------------

FIGURED IT OUT.

Turns out "January is 0" so you have to add one to the month to get the correct month.

Here is the final code (probably a shorter way to write this, but I'm a newb at JS):

var date = new Date();
date.setMonth(date.getMonth()+1);

date.setDate(date.getDate() + 7);

var control = NWF$("#"+ mydatecalccontrol); if(control.val() == ""){ control.val(date.getMonth() + "/" + date.getDate() + "/" + date.getFullYear()); }

date.getMonth() + "/" + date.getDate() + "/" + date.getFullYear()

Will give you the correct formatting for the US

Userlevel 7
Badge +10

Whoops! Sorry I spaced on that. I always forget how funky date is in JS... So that works for you now? 

Badge +3

Yes, working. Thank you!

Userlevel 7
Badge +10

Can you go ahead and mark an answer as correct so that other folks with the same question can find it easier? 

Badge +5

Came across this issue as well, would be nice if Nintex just respected the default values. Obviously it used to as I was following a tutorial from 2015. JS will work fine but the more JS we add the less mantainable our solutions are.

Userlevel 7
Badge +10

Agreed 100%

Reply