aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes checkbox checked always if only checked for the first time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "checkbox checked always if only checked for the first time" Watch "checkbox checked always if only checked for the first time" New topic
Author

checkbox checked always if only checked for the first time

scott prichard
Greenhorn

Joined: Apr 06, 2006
Posts: 10
Hello all,

I am trying out some stuff in javascript and wanted to check whether the situation where if we check the checkbox once, it should remain checked always. In other terms it needs to be persisted. Is it possible and if so can you suggest a best practice because I heard its not best practice to make database calls from UI.

Thanks
Scott
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

Originally posted by scott prichard:
I heard its not best practice to make database calls from UI.


It's a horrible practice to perform DB access in the UI.

But without more info about your app, there's not much help you can get. For example, what's powering the backend? Servlets? php? Other?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
scott prichard
Greenhorn

Joined: Apr 06, 2006
Posts: 10
The request goes into a servlet and the database operatiosn are by session beans.

Scott
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

So you are using EJB?
scott prichard
Greenhorn

Joined: Apr 06, 2006
Posts: 10
yes i am using ejb.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

Then I'm not sure where you are having an issue. The state of the checkbox will be submitted back to the server, the server can persists it however it likes. When the page is requested the page controller for the JSP fetches the state and sends it to the page where the checkbox markup can be accordingly contstructed.

Where's the problem? Is it in constructing the HTML? Storing the state on the server? Fetching the state?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: checkbox checked always if only checked for the first time