You are viewing limited content. For full access, please sign in.

Question

Question

Forms 12 Date Validation Using Javascript

asked on February 6 Show version history

I'm using a slightly modified script from https://doc.laserfiche.com/laserfiche.documentation/12/userguide/en-us/content/process-field-ref-date.htm 

const dateValues = LFForm.getFieldValues({
	fieldId: 27
});
const dateAsArray = Array.isArray(dateValues) ? dateValues : [dateValues];

return dateAsArray
  .filter((d, idx) => idx !== field.index && d.dateTimeObj !== null &&
new Date(d.dateTimeObj).getTime() === date.getTime()
).length === 1;

to only allow dates that are in a table to be selected. The table would be hidden and populated by a stored procedure.  

The code works if you manually add a date to the table, but if the table is populated via lookup rule, the code does not seem to pull in the dates. If you click into the table date field and re-select the date, the code will pull that individual date. You'd have to click on all the dates to get the date picker to filter correctly.

The goal is to have the code pull in the dates that are populated by a lookup rule and correctly filter the date picker.

Populated via lookup

 

Populated via manually selecting

 

Any help is appreciated!

0 0

Replies

replied on February 9

Hi Dylan, I was able to reproduce it on 12.0.2410.345 and I have filed bug for it #575309. Thanks for reporting the issue.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.