SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    May 2006
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    document.form.field.disabled on IE

    Hi

    I need to make some validations on my form
    for example there is two options (2 radios) and two text fields
    when the user click on the first radio button it should enable the 1st text field and disabled the 2nd text field..

    thats not the problem

    the problem is, document.formName.fieldName.disabled = false (or true) works fine on firefox doesn't work on Internet Explorer, why?

    Please help me

    Thanks

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you have some code to show?

  3. #3
    SitePoint Member
    Join Date
    May 2006
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes sure my bad

    * it's half in portuguese

    HTML Code:
    <html>
    <head>
    <script language="javascript">
    function ativaOutroProduto(val) {
    	if (val == "outro") {	
    		document.cadRapido.nomeProduto.disabled = false;
    		document.cadRapido.modeloProduto.disabled = false;
    		document.cadRapido.serieProduto.disabled = false;
    	}
    	if (val != "outro" || val == "") { 
    		document.cadRapido.nomeProduto.disabled = true; 
    		document.cadRapido.modeloProduto.disabled = true;
    		document.cadRapido.serieProduto.disabled = true;
    	}
    }
    </script>
    </head>
    
    <body>
    <form name="cadRapido" method="post" action="#">
    <select name="listaProduto">
     <option onclick="ativaOutroProduto(this.value)" selected="selected">Selecione o produto</option>
                      <option value='macbook pro'>macbook pro</option><option value='Mouse Optico'>Mouse Optico</option><option value='HD Seagate 120gb'>HD Seagate 120gb</option>                  
                      <optgroup label="New Item">
                      <option value="outro" onclick="ativaOutroProduto(this.value)">Add New Item:</option>
                      </optgroup>
                  </select>
    
    Name: <input type="text" size="20" name="nomeProduto" disabled="disabled" value="Novo Produto" onclick="this.value=''" />
    Modelo: <input name="modeloProduto" type="text" id="modeloProduto" disabled="disabled" onclick="this.value=''" size="20" />
    Serie: <input name="serieProduto" type="text" id="serieProduto" disabled="disabled" onclick="this.value=''" size="20" />
    <input type='submit' value='submit'>
    </form>
    </body>
    </html>

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    IE does not support the onclick event for options.
    Consider using the select object's onchange event.


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
  •