[JS/XHTML] Form elementen disablen

Pagina: 1
Acties:

  • cyberstalker
  • Registratie: September 2005
  • Niet online

cyberstalker

Eersteklas beunhaas

Topicstarter
Ik probeer alle elementen in een bepaald formulier te disablen.

Het gaat om het volgende formulier:
HTML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<form action="/tsuapp/person" method="post" id="profile">
    <fieldset>
        <legend>Kort profiel</legend>
        
        <input type="hidden" name="saveuser" value="true" />
        <input type="hidden" name="personid" id="personid" value="851" />
        <a href="/tsuapp/person/photo/851">
            <img src="/tsuapp/faces/big/phpPSRWBS.png" alt="Foto van Martijn" title="Foto van Martijn" id="picture_profile" />
        </a>
        <label>Status</label>
        <div class="state">
            <input type="radio" value="1" name="status_profile" id="status_1" /><label for="status_1">Actief</label>
            <input type="radio" value="2" name="status_profile" id="status_2" /><label for="status_2">Ontslagen</label>
            <input type="radio" value="3" name="status_profile" id="status_3" /><label for="status_3">Gestopt - NIET meer bellen</label>
            <input type="radio" value="4" name="status_profile" id="status_4" /><label for="status_4">Gestopt - nog wel bellen</label>
            <input type="radio" value="5" name="status_profile" id="status_5" /><label for="status_5">Pauze</label>
            <input type="radio" value="6" name="status_profile" id="status_6" checked="checked" /><label for="status_6">Kantoormedewerker</label>
            <input type="radio" value="7" name="status_profile" id="status_7" /><label for="status_7">Klant</label>
        </div>
        
        <label>Vestiging</label>
        <div class="department">
            <input type="checkbox" name="department_profile[]" id="department_1" value="1"  checked="checked" /><label for="department_1">TSU Haarlem</label>
            <input type="checkbox" name="department_profile[]" id="department_5" value="5"  /><label for="department_5">TSU Groningen</label>
            <input type="checkbox" name="department_profile[]" id="department_9" value="9"  /><label for="department_9">TSU Den Haag</label>
            <input type="checkbox" name="department_profile[]" id="department_11" value="11"  /><label for="department_11">TSU Amsterdam</label>
            </div>
        
        <label for="name_first_profile">Voornaam</label>
        <input type="text" name="name_first_profile" id="name_first_profile" value="Martijn" />
        
        <label for="name_suffix_profile">Voorvoegsel</label>
        <input type="text" name="name_suffix_profile" id="name_suffix_profile" value="" />
        
        <label for="name_last_profile">Achternaam</label>
        <input type="text" name="name_last_profile" id="name_last_profile" value="Otto" />
        
        <label for="birth_day_profile">Geboortedatum</label>
        <input type="text" name="birth_day_profile" id="birth_day_profile" value="06" />
        <input type="text" name="birth_month_profile" id="birth_month_profile" value="10" />
        <input type="text" name="birth_year_profile" id="birth_year_profile" value="1983" />
        
        <label for="gsm_profile">GSM</label>
        <input type="text" name="gsm_profile" id="gsm_profile" value="06-45267117" />
        
        <label for="tel_profile">Vast</label>
        <input type="text" name="tel_profile" id="tel_profile" value="023-5310128" />
        <label for="email_profile">Email</label>
        <input type="text" name="email_profile" id="email_profile" value="martijn@thesalesunit.nl" />
        
        <label for="repscode_profile">REPS code</label>
        <input type="text" name="repscode_profile" id="repscode_profile" value="1marot" />
        
        <label for="sofinummer_profile">Sofi nummer</label>
        <input type="text" name="sofinummer_profile" id="sofinummer_profile" value="" />
            
        <ul>
            <li><input type="submit" value="Opslaan" title="Wijzigingen opslaan" /></li>
            <li><a href="/tsuapp/person/password/851" title="Wachtwoord versturen">Wachtwoord</a></li>
        </ul>
    </fieldset>
</form>


Ik gebruik de volgende javascript-code:
JavaScript:
1
2
3
4
5
6
        var inputs      = document.getElementById('profile').getElementsByTagName('input');

        for (i = 0; i < inputs.length; i++)
        {
                inputs[0].disabled = true;
        }


Het stomme is dat ik bij deze code geen fouten krijg, maar dat er ook niets gebeurt. Ik heb ook al disabled = "disabled" geprobeert, maar zonder veel resultaat.

Ik ontken het bestaan van IE.


  • XWB
  • Registratie: Januari 2002
  • Niet online

XWB

Devver
inputs[i].disabled ipv inputs[0].disabled ?

March of the Eagles


  • crisp
  • Registratie: Februari 2000
  • Nu online

crisp

Devver

Pixelated

Moet dat niet
JavaScript:
1
inputs[i].disabled = true;

zijn?

Intentionally left blank


  • cyberstalker
  • Registratie: September 2005
  • Niet online

cyberstalker

Eersteklas beunhaas

Topicstarter
Juist ja. Een van de meest stompzinnige fouten ooit. I.i.g. bedankt.

Ik ontken het bestaan van IE.


  • André
  • Registratie: Maart 2002
  • Laatst online: 14:48

André

Analytics dude

:D