*
The moose likes HTML, CSS and JavaScript and the fly likes enable/disable Save button for multiple fields in a from Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "enable/disable Save button for multiple fields in a from" Watch "enable/disable Save button for multiple fields in a from" New topic
Author

enable/disable Save button for multiple fields in a from

praneeth ram
Ranch Hand

Joined: Sep 21, 2009
Posts: 60
Hi All,

I want to enable/disable save button after 8 fields validation in my page.
I have old technique:- that is keep a boolean flag for every field(in our case 8 flags), update corresponding field(when the fileld is valid/invalid) and check, if all the flags are true then only "enable/disable" save button.

My question is do we have any better approach, like using one variable.


I am very thankful for any suggestions/solutions.

Thanks,
Praneeth
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

You don't need any variables at all. Have a change handler on the form that checks to see if the validation requirements are met, and change the state of the button if so.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: enable/disable Save button for multiple fields in a from
 
Similar Threads
JFormattedTextField
Enable/disable buttons - File download(CSV)
text filed and button validation
Disable a button depening on hidden element
adding listeners