Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using custom JS to set a date is not working as expected #103

Open
RichardWoj opened this issue Oct 13, 2023 · 1 comment
Open

Using custom JS to set a date is not working as expected #103

RichardWoj opened this issue Oct 13, 2023 · 1 comment

Comments

@RichardWoj
Copy link

Describe the problem
I need to set an "issuance date" to today's date as soon as the user has filled an amount field for an invoice.
I do so with a javascript:
const issuanceDateInput = container.querySelector('.issuance-date-input input[type="text"]');
amountInput.addEventListener('change', () => {
if (amountInput.value !== "") {
issuanceDateInput.value = formatDate(new Date());
issuanceDateHiddenInput.value = formatDate(new Date());

The calculated value is displayed on the browser but the value is not in the post message sent to the server
Do I have to trigger some event?

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
I am expecting the value displayed by the browser to be part of the post message sent to the server

Console errors

  • No error on django console.
  • No error on JavaScript console.

Paste-bin
The page is showing up but the date-picker calendar is not. The paste-bin link
of the HTML source of the page is http://...

Setup Information (please complete the following information):

  • OS: [e.g. Windows 10] Windows
  • Browser [e.g. chrome, safari] Edge
  • Browser version [e.g. 22]
  • Python version [e.g. 3.7] 3.11.3
  • Django version [e.g. 2.1]
  • Bootstrap version [e.g. 3/4] 5
  • jQuery version [e.g. 1.7.1]

[x] I have followed the configuration instructions and checked out the
common error troubleshooting page.

@silvioba
Copy link

silvioba commented Mar 12, 2024

I observed this too. It's very annoying.
How did you fixed @RichardWoj ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants