Advertisement

08.23.2007 at 06:07AM PDT, ID: 22782051
[x]
Attachment Details

validate text box

Asked by erikTsomik in JavaScript, Extensible HTML (XHTML), Dynamic HTML (DHTML)

Tags: , ,

I have 2 text boxes. 1 called school name , another gpa. If school name is not empty I need to make gpa field as mandatory, if it is empty then optional . I wrote some Javascript together with Ajax.

function validSchool(obj){
            
            if (obj.value != ''){
                  var collegeGpa= new Spry.Widget.ValidationTextField("college2gpa", {validateOn: ["onblur","change"]});
                  
            collegeGpa.reset();
            collegeGpa.validate();
            
            
            }
      }
My HTml is here
<!---School 2 name--->
                                           <div class="aaprowindent">
                    <div id="college2" >
                  <span class="label"><div class="college2">School Name:</span></div>
                  <input name="college2" type="text" id="college2" size="40" onblur="validSchool (this.value)"/>
                  </div>
            </div>

   <div class="aaprowindent">
                    <div id="college2gpa" >
                  <span class="label"><div class="college2gpa">GPA:</div></span>
                  <input name="college2gpa" type="text" id="college2gpa" size="40"/>
                  <span class="textfieldRequiredMsg">Please enter a valid GPA.</span>      </div>
            </div>
        Start Free Trial
[+][-]08.23.2007 at 06:20AM PDT, ID: 19754027

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.23.2007 at 06:23AM PDT, ID: 19754069

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.23.2007 at 06:24AM PDT, ID: 19754076

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Extensible HTML (XHTML), Dynamic HTML (DHTML)
Tags: text, validate, boxes
Sign Up Now!
Solution Provided By: RaisinJ
Participating Experts: 1
Solution Grade: B
 
 
[+][-]08.23.2007 at 06:30AM PDT, ID: 19754129

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628