SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2002
    Location
    Kentucky, USA
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript and forms help

    Ok, i have this form (in php) that uses multiple selects and another name on multiple checkboxes. Well when doing multiple things you have to have name="blah[]" you have to add [] after the name, well when i tell the JS that the name of the field is blah[] it says not an object. How do i make it think its a the field instead of an object? Thanks for your help! Here is the JS i have. (note: it works without the [] on the name).

    PHP Code:
    function checkAll(subvalue) {
                
    field document.form.permission[];
                
    field2 document.form.categories[];
                if (
    subvalue == "Admin") {
                    for (
    0<field.lengthi++) {
                        
    field[i].checked true;
                        
    field[i].disabled true;
                    }
                    for (
    0field2.lengthi++) {
                        
    field2[i].selected true;
                    }
                    
    field2.disabled true;
                } else if (
    subvalue == "Comment") {
                    for (
    i=0i<field.lengthi++) {
                        
    field[i].checked false;
                        
    field[i].disabled true;
                    }
                    for (
    0field2.lengthi++) {
                        
    field2[i].selected false;
                    }
                    
    field2.disabled true;
                } else if (
    subvalue == "Custom") {
                    for (
    i=0i<field.lengthi++) {
                        
    field[i].checked false;
                        
    field[i].disabled false;
                    }
                    for (
    0field2.lengthi++) {
                        
    field2[i].selected false;
                    }
                    
    field2.disabled false;
                }
            } 

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2002
    Location
    Kentucky, USA
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fixed, no need to help

  3. #3
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's amazing what looking at your problem on a forum can
    do for you

    good luck

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •