Skip to main content

Pre-fill dynamic form "date" fields and get web page change alerts

By Stephen, Updated 20 January, 2025
Topic

A common situation is when you need to pre-fill / fill-in some data in a web page form such as the "current date", this an example would be when booking a trailor or reserving a car-parking space.

 

Pre-fill date field before web page change detection

Obviously, entering the current date directly is going to be a lot more easier to configure than using the calendar that the web page comes with (which are often really hard to navigate, even by humans!)

One really great feature of changedetection.io is that we try to support "Jinja2" macros where-ever possible, so this means you can insert the current date/time in whatever format you like using Browser Steps

 

 

So let's get to it!

 

 

Automatically enter he current date in an input box

 

  • Activate the Browser Steps for the webpage you are monitoring for changes, give it a few moments to connect.
  • Mouse over the input field (highlighted in red) and click it.
  • The software will identify the element as an input/text box and ask you to enter some text, this is where the magic happens.

     

Setting the current date in a field before web page change detection

 

 

Now the website automatically prefills the date with next months date, but we want to be sure we enter todays date when ever the web page change detection runs, so that we could perhaps see if any car parking places are available today.

  • Enter {% now  'Europe/Berlin', '%d-%m-%Y' %}  in the "value" field under the "Enter text in field" box on the right.
  • Click Apply to see the changes take affect.

 

 

Automatically set the date on web page change detection form

 

 

Now you can see that the field is correctly set to today's date ( 20-1-2025) According to the "Europe/Berlin" timezone)

 

Entering a timezone is super important, because the server may run in a different timezone than yourself, you can choose any timezone from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

 

 

As always, Happy web page change detection :)