By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.

validation thread

P: 21
I have prototype.js script.js, validate_form.js and lib,src forlder for valdate the user registration. i want to use other field validation. when user click from drop down "other" then are displaying other text field and i putted validation="urt_m"
it works fine. but when user does not wnt select from other only wnt select from drop down menu and submit then other field not displaying but message displaying " * mondatory field" but this not should be. this shoud be when user select only other field. and java script problem displaying:
" Line:1595
Error:Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus"
URL: http://localhost/Yretire_new/index.p...ion&action=Add

[MY code goes here of js -> this is for Hide and show in validate_form.js]

Expand|Select|Wrap|Line Numbers
  1. function HideShowOther(obj, id)
  2. {
  3.     txt = obj.value;        
  4.     if ( txt  == 'Other') 
  5.     {                
  7.     } 
  8.     else
  9.     Element.hide(id);
  11. }
[& in Prototype.js]

Expand|Select|Wrap|Line Numbers
  1. Element.Methods = {
  2.   visible: function(element) {
  3.     return $(element).style.display != 'none';
  4.   },
  6.   toggle: function(element) {
  7.     element = $(element);
  8.     Element[Element.visible(element) ? 'hide' : 'show'](element);
  9.     return element;
  10.   },
  12.   hide: function(element) {
  13.     $(element).style.display = 'none';
  14.     return element;
  15.   },
  17.   show: function(element) {
  18.     $(element).style.display = '';
  19.     return element;
  20.   },
  22.   remove: function(element) {
  23.     element = $(element);
  24.     element.parentNode.removeChild(element);
  25.     return element;
  26.   },
So, Please solve my problem.

Thanks in advance.
Aug 5 '08 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 15k+
P: 16,027
The error is caused by focus problems. Show your validation code where you validate the drop-down/other field.

Please use the code tags properly. Use the # button when posting to wrap your code in code tags. The posting/reply guidelines on the right when you post also show you how to use code tags as does How to Ask a Question in the FAQ.
Aug 5 '08 #2

P: 607
hi, I am suggesting a way that how I used in my code for registration. I kept the Drop down menu in a form and the rest in the other form. When an item is selected from the drop down menu, I set the selected value to an hidden input element in the other form. So we can use that value easily for validartion without any problem.

Ramanan Kalirajan.
Aug 5 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.