SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    js filling select box value

    Hey,

    I'm trying fo fill the select box value from my parent page using poupop.
    The point is I'm filling the select content but can't using when submiting the form.
    I guess is due the text and value option properties...I figure i'm just reaching the text..
    So, I already tried:
    HTML Code:
    opener.formname.inputname.options.value = document.formname.inputname.value;
    opener.formname.inputname.options.text = document.formname.input.value;
    No luck so far...
    Any clue?

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2006
    Posts
    182
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    opener.formname.inputname.appendChild(new Option(newText, newValue))
    http://www.quirksmode.org/js/options.html

  3. #3
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any clue?
    Post an example of the select html before any changes and then what you want the select html to look like after the changes. Then maybe someone can help you.

  4. #4
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by funkdaddy View Post
    Code:
    opener.formname.inputname.appendChild(new Option(newText, newValue))
    http://www.quirksmode.org/js/options.html
    No luck, but thanks for posting..

    I also tried to call this function from my popup...(same scenario)

    function atualiza_select_box(id_select,s)
    {
    var_select=document.getElementById(id_select)

    var_select.options[0]=new Option(s,s);

    }

  5. #5
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 7stud View Post
    Post an example of the select html before any changes and then what you want the select html to look like after the changes. Then maybe someone can help you.
    As for my select..well there's not much to say and anything special at all..

    I retrieve the values from a recordset:
    HTML Code:
    <select name="periodo_calibra" id="periodo_calibra" class="cn" disabled>
              <% 
    			Dim rscalibracao
    			Set rscalibracao = Server.CreateObject("ADODB.Recordset")
    			rscalibracao.Open "SELECT tempo_calibracao FROM base_status ", conBD
    			
    			
    			IF isempty(periodo_calibra) then%>
              <option value="" selected>Selecione o intervalo</option>
              <%
    				Else
    				%>
              <option value="<%=periodo_calibra%>" selected><%=periodo_calibra%></option>
              <%
    		End if
    			Do While Not rscalibracao.Eof
    			If cint(rscalibracao.Fields("tempo_calibracao"))<10 then espaco="  &nbsp;&nbsp;" else espaco="  " end if
    			%>
              <option value="<%response.Write rscalibracao.Fields("tempo_calibracao")%>">
              <%response.Write rscalibracao.Fields("tempo_calibracao")&espaco&"meses"%> </option>
              <%
    			rscalibracao.MoveNext
    			Loop
    			rscalibracao.close
    			Set rscalibracao = Nothing
    			%>
            </select>

  6. #6
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well...
    I don't see much sense, but I kept my first posted code and added this single line before changing the select values:
    opener.formname.inputname.disabled=false

    Now it works ok...

    Does anyone knows why?

    I didn't find anything regarding disabled status on inputs...


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
  •