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

Question

Question

[Forms 11] How to disable certain days in a Date field using JavaScript or otherwise?

asked on April 23

Hi all,

I'm trying to upgrade a form from the Classic Editor to the new form designer available in Forms 11. In the old form, there is some JavaScript (well, jQuery) that disables certain dates on a Date field. It's definitely based on this answer: https://answers.laserfiche.com/questions/170752/Ability-to-restrict-dates-in-forms#171323

Here's what it looks like in the old form:

Only every other Monday should be available. This worked by directly targeting the element and editing it in the UI from there.

I understand the differences in JavaScript between the Classic and new forms designer. It doesn't use jQuery and you can only access field elements by the LFForms interface. Indeed I am able to target this field in the new version of the form with:

LFForm.findFieldsByVariableName("Effective_Date"); 

There are a lot of data and methods available on this object covered here. I am able to change the value of the field, change field settings, add event listeners, etc.

But I'm still not sure how to achieve the same effect, that is, disabling certain (or any) dates on the calendar that pops up with the datepicker. 

Does anyone have any experience with this?

0 0

Answer

APPROVED ANSWER SELECTED ANSWER
replied on April 23

It's available in version 12, but I don't think 11. You can watch this video to see how it's done in the new layout designer in version 12: https://youtu.be/A1R6p5Tvm5k?si=cCC-HY-Eg7oISKEB

1 0
replied on April 23

Thank you, the dynamic date features in 12 would solve a lot of my issues... I'm leaving this question open for now in case anyone has some offbeat workaround for version 11, but I appreciate the video!

1 0

Replies

replied on April 23

I don't believe this will work in the New Layout Designer JS yet.  It would have to remain in classic.

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

Sign in to reply to this post.