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
Hi
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
Char:3
Error:Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus"
Code:0
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.     {                
  6.         Element.show(id);
  7.     } 
  8.     else
  9.     Element.hide(id);
  10.  
  11. }
  12.  
[& in Prototype.js]

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

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


acoder
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

RamananKalirajan
100+
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.


Regards
Ramanan Kalirajan.
Aug 5 '08 #3

Post your reply

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