Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Change value in form onClick

 
Jill Snider
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.
 
Eric Pascarello
author
Rancher
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
Rancher
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!
 
Justin Fox
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()


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic