Question closed! How to prefil a current date input using HTML CSS? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Question closed! How to prefil a current date input using HTML CSS?

Hi, I use HTML/CSS for filling in forms online and the output is a document PDF. Is there a HTML/CSS-only solution for adding a current (system)date dd/mm/yyyy to this document, without using javascript or php? Thanks in advance.

12th Aug 2020, 3:27 PM
Bernard Kemman
Bernard Kemman - avatar
10 Answers
+ 4
Example of script tag: <script> //Javascript in here // place this tag at the bottom before ending body tag </script> But again, its using javascript. im sorry that i couldnt help u :(
12th Aug 2020, 7:13 PM
maf
maf - avatar
+ 3
:( But can't you use <script> tag? Why is your software limited tho?
12th Aug 2020, 5:16 PM
maf
maf - avatar
+ 3
Bernard Kemman lol no problem :)
12th Aug 2020, 7:23 PM
maf
maf - avatar
+ 2
I'm sorry you would have to use javascript :( let date = new Date() console.log(date.getFullYear()) you can dynamically change HTML's display of date from javascript document.getElementById("yourDate").innerText = date
12th Aug 2020, 5:08 PM
maf
maf - avatar
+ 2
Thnx "maf" but unfortunately our software environment doesn't allow JS :-( , Just HTML CSS.
12th Aug 2020, 5:11 PM
Bernard Kemman
Bernard Kemman - avatar
+ 2
The reason of not using JS, is that we are using XML for filling in fields/forms. The data is used to produce documents in pdf, like personalized contracts for example.
12th Aug 2020, 5:50 PM
Bernard Kemman
Bernard Kemman - avatar
+ 2
Can you give me an example of the script-tag?
12th Aug 2020, 5:51 PM
Bernard Kemman
Bernard Kemman - avatar
+ 2
Unfortunately, I was wondering I could save time by prefilling dates in the forms. A good excuse to study JS, thnx a lot maf.
12th Aug 2020, 7:22 PM
Bernard Kemman
Bernard Kemman - avatar
+ 1
JME I already thought something like that, because I can't find any solution on the web. Just a time attribute which isn't working....
12th Aug 2020, 4:16 PM
Bernard Kemman
Bernard Kemman - avatar
0
Nope, have to use js for dynamic content like that.
12th Aug 2020, 4:12 PM
JME