Skip to main content
Participant
July 26, 2025
Question

PDF Formular Datumsfeld Eigenschaften Validierung Feldwert ist im Bereich

  • July 26, 2025
  • 1 reply
  • 96 views

Guten Tag,

ich möchte in einem Formular ein Datumsfeld erstellen und den Feldwert auf die Auswahl der Daten aus Kalenderjahr 2027 eingrenzen. Die Möglichkeit "Feldwert ist im Bereich" ist bei mir ausgegraut und somit nicht nutzbar.

Dazu sollen nur Mo-Fr zur Auswahl stehen sowie Feiertage von der Auswahl ausgeschlossen werden. 
Ich habe es mit verschiedenen Befehlen über Javascript versucht, aber keine Lösung gefunden.
Für eine funktionierende Lösung wäre ich Ihnen sehr dankbar.

1 reply

try67
Community Expert
Community Expert
July 26, 2025

You need to convert the selected value to a Date object and then you'll be able to analyze it and reject the selected value if it's not valid. Here's an example that will only accept weekdays from 2027:

 

if (event.value) {
	var d = util.scand("dd/mm/yyyy", event.value);
	if (d.getFullYear()!=2027) {
		app.alert("You must select a week-day from 2027.");
		event.rc = false;
	} else if (d.getDay()==0 || d.getDay()==6) {
		app.alert("You must select a week-day from 2027.");
		event.rc = false;
	}
}

 

Note you can't limit the selection in the calendar widget, though. You can only reject an invalid date, once it was selected.