• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

JSP and Javascript

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have several fields: checkbox, label, and a submit button. The scenario is as follows:

if checkbox = true
enable label/submit

else

disable label/submit

Now, the checkbox is persistant so I need a way to enable/disable the label and submit when returning to the page based on the value of the checkbox. This is a jsp page that uses a value object to maintain the variable. How can I do this?

Thanks in advance!
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like a simple matter of conditionals on the page. Use <c:if> is using the JSTL (you should be, imo) or if statements in scriptlets otherwise.

Nothing to do with Javascript for when the page is refreshing.
 
K Robert
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, my problem is this... I have a value-object that maintains the value of the checkbox. When the page loads, if the the value is true, I enable the label/submit combo. However, if after the page loads, I decide to uncheck the box, it disables the label/submit combo.

So, I have no problem checking the value-object for true/false and I have no problem creating the javascript to enable/disable the button when the user takes action. I just can't seem to combine the two.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://coderanch.com/t/117073/HTML-JavaScript/Checking-value-load

Eric
 
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic