Loading ...
Sorry, an error occurred while loading the content.
 

Getting the Value and Text of an Select inside a YAHOO.widgetDialog

Expand Messages
  • Daniel Nunes
    It seems that when you submit the dialog to process it with a JS function, the select only sends its Value, and not its text. When I use the selectedIndex it
    Message 1 of 1 , May 7 7:56 AM
      It seems that when you submit the dialog to process it with a JS
      function, the select only sends its Value, and not its text. When I
      use the selectedIndex it says that this property does not exist. Is
      there another way?

      var okDialog = function(){
      //Aqui o this é o Dialog!!
      var dados = this.getData();
      var selValue = dados.selProf;
      Dom.get(this.idInput).value = selValue;
      this.hide();
      };
      var dialogProfessores = new YAHOO.widget.Dialog("dialogProf",

      {width:"220px",modal:true,visible:false,constraintoviewport:true,fixedcenter:true,postmethod:"none",

      buttons:[{text:"Aceitar",handler:okDialog},{text:"Cancelar",handler:cancelaDialog}]
      }
      );

      The Dialog:

      <form method="POST" >
      <b>Escolha um item abaixo:</b><br><br>
      <select id="selProf" name="selDialog" size=\"10\"
      style="font-weight:bold">
      <option style="color:green" value="111">Text 1</option>
      <option style="color:green" value="222">Text 2</option>
      </select>
      </form>
    Your message has been successfully submitted and would be delivered to recipients shortly.