• 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

Change value in form onClick

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have radio buttons to select 'ALL' or a 'Custom' date in a JSP web application.
Custom date works great and so does ALL.
However, if the user changes their mind and goes from Custom to ALL, the dates remain.
I’m already using an onClick Javascript to hide/unhide the custom fields that show up to enter a dates in a text input field when ALL is selected.





I would like to be able to reset the date field if the user selects all by including a command in the onClick Javascript.


I’ve tried everything I can think of! Any help would be appreciated.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
allSelected !== AllSelected
 
Jill Snider
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,

Thank you so much for the reply.
However, it didn't work.

When I toggle back betwen Custom and ALL it still shows and carries the values over to the next page.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well do you have an error message in the console?

Eric
 
Jill Snider
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No error message at all upon compile or running in the browser.
It just has the old values from custom when I select ALL again and when I go to the next page in a form.
Ultimately, I would like to reset the values not only when selecting the ALL radio button but also when using the Back Button.
Arg!

Thanks for your help!
 
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jill Snider wrote:Hi all,



I think your function call names need to be the same, for example in the onclick you have 'allSelected', but your function is defined as 'Allselected()'.

Also, I've never used visibility so it could work, but I've always used ...style.display = "none";

I'm surprised it didn't give you an 'object expected' error. But if you're using ff it will just not work, won't give you errors like IE.

Justin
 
Jill Snider
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
Thank you all for your help.
I figured this out and wanted to post what ended up working for me in case anyone else had the same issue.

The HTML:



The javascript for the functions 'toggle()' and 'allSelected()'

toggle()



allSelected()


 
What's wrong? Where are you going? Stop! Read this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic