File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Need some suggestion preventing user mouse click 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 "Need some suggestion preventing user mouse click" Watch "Need some suggestion preventing user mouse click" New topic
Author

Need some suggestion preventing user mouse click

Ayan Dutta
Ranch Hand

Joined: Oct 16, 2005
Posts: 94
A have to develop a page where there are few tabs, say tab1 ,tab2 and tab3 .Clicking on tab1 a page appears.
In this page there are some input fields (say X,Y,Z )and many buttons like edit,delete ,save .

Now requirement is if the user enters a wrong data in the field X,then

1.he should not able to move out from X .
That is he should not able to navigate/move to Y,Z and enter anything.
2.he should not able to click any of the buttons (edit,delete,save )
3.he should not able to click any of tabs(tab2 and tab3).

I have a method which validate X,Y ,Z .
say this method name is validateFieldInput() it gets invoked on the onblur of X.
What I think is that
If validateFieldInput() can have the ability to disable mouse click when the data is wrong and enable the mouse click when correct data is entered , the situation 1,2,3 is handled at a single go .

What you people suggest ? Is that possible ?

If that is possible please help me how this can be done .
Even if there are other better ideas please suggest .
But is my approach is possible or not I want to know .

Regards,
Ayan
Shawn Montague
Greenhorn

Joined: Aug 06, 2008
Posts: 25
On page load you could disable all the elements the user cannot access. Then, you could validate X as the user enters data (using onkeydown, onkeyup perhaps). if the user input in X becomes valid at any point, enable Y...follow the same process for each input until the user completes Z, then enable your buttons or tabs or whatnot.

sounds like a lot of work in any event. can't you just verify the entire form in one go rather than one element at a time?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60059
    
  65

Originally posted by Ayan Dutta:
1.he should not able to move out from X .
That is he should not able to navigate/move to Y,Z and enter anything.
I'd rethink this one. That would be very annoying. To the point where I'd just close the browser and go elsewhere.

It's fine to not be ale to submit the form until all input is correct. To not let them leave the field is just outright rude and annoying.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ayan Dutta
Ranch Hand

Joined: Oct 16, 2005
Posts: 94
Yes I agree that it is in fact annoying, but that is how the requirement is at the business level .If I have a system which I can develop in my own way ,then no way I am going allow these sort of restrictions.But unfortunately the requirement is like that .
Any generic idea / solutions keeping the requirements in mind ?
Regards,
Ayan
Ayan Dutta
Ranch Hand

Joined: Oct 16, 2005
Posts: 94
Any idea from anybody ?
Regards,
Ayan
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
have you looked into onblur with your validation? Have you looked into disabled? Have you looked at modifying an onclick to see if an action can take place?

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need some suggestion preventing user mouse click
 
Similar Threads
swing tabbed pane alignment
How to load tab content upon clicking the tab in JTabbedPane?
jsp response problem
Help with tabbed Panel
RichFaces TabPanle problem