Git Product home page Git Product logo

Comments (5)

adamstep avatar adamstep commented on May 26, 2024

Can you explain the overall experience you're trying to implement? If I understand correctly, you have an input widget for selecting a month and year, and then you want to update a calendar view below the input widget when the date is changed. Is that right?

from intercooler-js.

beanben avatar beanben commented on May 26, 2024

That's correct. And the code above works. The issue I have is that , on refresh, the default values for the form (today's month and today's year) are not displayed.

In more detail:

  1. the user select , say, March and 2020
  2. press submit
    --> the calendar is correctly updated
  3. then , for whatever reason, the user presses refresh
    --> the calendar gets correctly updated with the default values (today's month and today's year)
    But the form still shows March and 2020.

What is interesting as well is that the page source shows that the form is correctly initiated with the initial values (today's month and today's year) but the page still displays March and 2020.

Does this make sense ?

from intercooler-js.

adamstep avatar adamstep commented on May 26, 2024

Yes, that makes sense but I don't think it's related to Intercooler. Check out this gist where I think I captured a UI similar to what you explained: https://gist.github.com/adamstep/186c56500afd05b4179e562b9cbe5b42

When I refresh, I get the same default date in the input and the display below. It sounds like maybe the web browser is remembering the previous input. Which browser are you using to test?

from intercooler-js.

beanben avatar beanben commented on May 26, 2024

I see, thank you for testing!
I am using Firefox. Would you know a way I could prevent that from happening ?

Also I may not be testing correctly but I cleared cache & cookies on Firefox, subsequently refreshed the page but the wrong date persist (March and 2020 in my example above).

Then again I tested the behaviour of the code on safari and I do not have that problem: on refresh, the default values for the dates are correctly displayed.

from intercooler-js.

beanben avatar beanben commented on May 26, 2024

turns out it's a Firefox-specific issue. This helped: https://stackoverflow.com/questions/4831848/firefox-ignores-option-selected-selected

I added an id to my form and :

window.onload = function() { document.forms['date_form'].reset(); };

to my js and all is well.

Thank you for your help Adam !

from intercooler-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.