Jump to content

justravis

Members
  • Posts

    115
  • Joined

  • Last visited

Posts posted by justravis

  1. Please try submitting both these forms without entering any data:

     

    http://reference.powerontechnologies.com/javascript/forms/validation_-_onlinetools.org/form_-_example_-_solution2.htm

    u: phpfreaks p: phpfreaks

     

    http://raise-the-bar.cc/programs/dmd/mentee/intro.pwr

     

    The error messages contain anchor tags to put focus on the feilds.  The first script works in IE & Firefox.  The second script only works in IE.

     

    Thots?

     

    Thank you.

  2. i thot it was the equivalent of return false; but i could not find any documentation stating the fact...tho i hav recently found instances where they behave differently...u r right...return false; is best.

  3. made a few corrections:

     

    <script src='intro.js'></script>
    <form method=post action=/programs/dmd/mentee/intro.pwr onSubmit='return validForm()'>
    <input name=required id=required type=hidden value='chan,subchan'>
    <label>How did you hear about Disability Mentoring Day?<br />
    <select name='chan' onChange='showSubchan(this.value)'>
    <option value=''>
    	Please choose.
    </option>
    <option value=2>
    	 San Diego Community College District
    </option>
    
    <option value=3>
    	 San Diego Unified School District
    </option>
    </select>
    <br />
    <div id='selectSubchan'></div></label>
    <input name=next id=next type=submit value=Next>
    </form>
    

     

    function validForm()
    {
    var elem=document.getElementById('chan');
    
    if(!elem.value)
    {
    	alert('chan');
    	elem.focus();
    	return false;
    }
    else
    {
    	return true;
    }
    }
    

  4. i'm just trying to check 1 select menu at this point...it doesnt even trigger

     

    <script src='intro.js'></script>
    <form method=post action=/programs/dmd/mentee/intro.pwr onSubmit='return validForm()'>
    <input name=required id=required type=hidden value='chan,subchan'>
    <label>How did you hear about Disability Mentoring Day?<br />
    <select name='chan' onChange='showSubchan(this.value)'>
    <option value=''>
    	Please choose.
    </option>
    <option value=2>
    	 San Diego Community College District
    </option>
    
    <option value=3>
    	 San Diego Unified School District
    </option>
    </select>
    <br />
    <div id='selectSubchan'></div></label>
    <input name=next id=next type=submit value=Next>
    </form>
    

     

    javascript

    function validForm(form)
    {
    elem=document.getElementByID('chan');
    
    if(elem.value == "Please Choose")
    {
    	alert(helperMsg);
    	elem.focus();
    	return false;
    }
    else
    {
    	return true;
    }
    }
    

     

    Any thoughts?

     

    THANK YOU!

  5. First, i did not need to pass the form name to any of my other validation functions, but is it necessary when dealing with checkbox arrays?

     

    Second, I tried 2 different approaches to figuring out if any checkboxes in the array are checked, but none of them work.

                                    function check_req(form, field, alerttext)
                                    {
                                            /*count_checked=0;
    
                                            for(i=1; i<field.length;i++)
                                            {
                                                    if(field.checked==true)
                                                    {
                                                            count_checked++;
                                                    }
                                            }
    
                                            if(count_checked==0)*/
                                            if(form.field.checked==false)
                                            {
                                                    alert(alerttext);
    
                                                    return false;
                                            }
                                    }
    

     

    http://www.powerontechnologies.com/_sites/vsd/savy/savy.pwr

     

    Any ideas?

     

    THANKS!

  6. OK...i altered your suggestion a bit, but I wanted to ask if there were advantages to using strcasecmp() (or any other differences in yr code) that i'm not aware of?

     

    foreach($_POST as $key => $postvar)
    {
         #Var name start with 'job'?
         if(substr($key,0,2)=='job')
         {
               #Var name end with 'quest'?
               if(substr($key,-5)=='quest)
               {
                    #Cycle thru checkbox array.
                    foreach($postvar as $quest)
                    {
                          echo "$quest<br />";
                     }
                }
         }
    }
    

     

    THANKS AGAIN!  You really got my mind going!  I WAS STUCK!!!

  7. i am dynamically creating a list of checkboxes for each job title in a db.

     

    the checkbox array names are something like 'job2quest[]' & the 'job5quest[]'...

     

    since i dont necessarily kno which jobs will appear, i dont want to hardcode the variables when the form is submitted.

     

    is there a way to pick apart post variable names, so the script can find the checkbox arrays?

     

    And/or is there a way to loop thru them?  (like if they could be named job[]quest[])

     

    thank you!!!

  8. I am creating a music database.  Each album will have a category and MAY have a sub-category.

     

    I'm thinking of making ONE category table with feilds:

    id, name, parent_id

     

    If it's a sub-category, the parent_id will be the id of the category in the same table.

     

    Does this sound right or is there a better way?

     

    THANK YOU!

  9. i have been knockin my head against the wall...it LOOKS good to me...i get the error @ 2613...then if i remove that line..the same error applies until i remove all after 2612...any thots?

     

    $project=array(

    7 => "Serving Meals",

    2612 => "Dining Room Attendant: 9/22, breakfast",

    2613 => "Dining Room Attendant: 9/23, breakfast",

    2614 => "Dining Room Attendant: 9/24, lunch",

    2615 => "Dining Room Attendant: 9/25, dinner",

    2616 => "Dining Room Attendant: 9/26, lunch",

    2617 => "Dining Room Attendant: 9/27, breakfast",

    2618 => "Dining Room Attendant: 9/27, dinner",

    2619 => "Dining Room Attendant: 9/28, dinner",

    2620 => "Dining Room Attendant: 9/29, lunch",

    2611 => "Dining Room Attendant: 9/30, dinner"

    );

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.