• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem while Validating 4 textboxes which are in sequence

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am facing problem while validating 4 textboxes which are in sequence.
My requirement is to fill the textboxes in order i.e. 1st text box should not be blank where any other textbox is filled and so on.
i tried using both onchange and onblur.
Thanks in advance.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what did you try? Show us your code.

Eric
 
pats Patil
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
function validntextbox4(p1,p2,p3,p4,s1)
{

if((p1.value =='')&& ((p2.value !='')||(p3.value !='')||(p4.value !='')))
{
s1.innerHTML="Please fill textboxes in order";


return false;
}

if((p2.value =='')&& ((p1.value !='')||(p3.value !='')||(p4.value !='')))
{
s1.innerHTML="Please fill textboxes in order";
// alert('Please enter values in textboxes ordrerwise');

return false;
}

if((p3.value =='')&& ((p1.value !='')||(p2.value !='')||(p4.value !='')))
{s1.innerHTML="Please fill textboxes in order";
//alert('Please enter values in textboxes ordrerwise');

return false;
}
if((p4.value =='')&& ((p1.value !='')||(p2.value !='')||(p3.value !='')))
{s1.innerHTML="Please fill textboxes in order";
//alert('Please enter values in textboxes ordrerwise');
return false;
}
}


onblur of 4 textboxes i have called the same function validntextbox4(p1,p2,p3,p4,s1).
s1 is span which shows error textmessages .
please help, this is just 1 example i have tried in different ways.
please provide me with the solution.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem you are probably facing is you do not have valid references to the form elements.

You should probably reference the form elements like


and for the s1


Eric
 
reply
    Bookmark Topic Watch Topic
  • New Topic