This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

More .js Calendar Problems

 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yet a new problem with javascript calendars from my end, learning is always fun:-).

I have an add project where a user inputs information and sets dates with a javascript calendar. I then have an edit page where the user can change the information they entered. If the user initially entered a date it displays the calendar picker for that field. However if the user initally left that field blank it will not show up in the edit page.

Example of the JSP to display the cal:


Example of my getter in the form:


Example of my setter in the form:


convertDate just converts a String of yyyy-DD-mm format into a java.sql.date in the same format to it can be stored in the database.
 
Chris Boldon
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to return null as well as "" in the getter as well...no go.
 
Chris Boldon
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1 More thing, when I check the info on teh edit page the hiddle fields are not present. When I define a hidden field with the same name as the hidden fields that are generated by the .js nothing is displayed either.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might try using a <logic:equal> or <c:if> to call your JavaScript calendar function in two different ways. If there is no date, call the function the same way you call it in your "add" program, with no input date expected. If If there is a date, call it the same way you're calling it now.
 
Chris Boldon
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Merrill, I'd like to thank you for pointing me in the right direction. I ended up using a logic:empty and logic:notEmpty. I kept thinking my problem was in the backend somewhere when it was really in the jsp.

Thank you.
 
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic