Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need some suggestion preventing user mouse click

 
Ayan Dutta
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ayan Dutta
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any idea from anybody ?
Regards,
Ayan
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic