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

Re: Dialog issue

Expand Messages
  • domingosjoffre
    ... wants ... my
    Message 1 of 5 , Apr 30, 2007
      --- In ydn-javascript@yahoogroups.com, "Daniel Nunes"
      <jaywalker1983@...> wrote:
      >
      > Hi to all,
      >
      > I got a question, I think it is a bit simple to solve but I couldn't
      > manage to make it work. When you create a dialog dynamically and
      wants
      > an event to form its submission(script way) how could you do that?
      >
      > Example: I create a form dynamically for my Dialog and attach a
      > ondblclick event on a select tag to send the responde via-script to
      my
      > page but I'm having a hard time to do that. Does anyone knows how to
      > do that?
      >
      > Thanks!
      >
    • Daniel Nunes
      Well, I m using Java to do it. So here is the code in the server: conteudo.append( ); conteudo.append( Escolha um item
      Message 2 of 5 , May 7, 2007
        Well, I'm using Java to do it. So here is the code in the server:
        conteudo.append("<form method=\"POST\" >");
        conteudo.append("<b>Escolha um item abaixo:</b><br><br>");
        conteudo.append("<select id=\"selProf\" name=\"selDialog[]\"
        size=\"10\" style=\"font-weight:bold\">");
        //for(int i=0;i < profs.length; i++){
        for(int i=0;i < itensSelect.length; i++){
        //conteudo.append("<option
        value=\""+profs[i]+"\">"+profs[i]+"</option>");
        if(i % 3 == 0){

        conteudo.append("<option style=\"color:red\"
        value=\""+itensSelect[i]+"\">"+itensSelect[i]+"</option>");
        }else{
        conteudo.append("<option style=\"color:green\"
        value=\""+itensSelect[i]+"\">"+itensSelect[i]+"</option>");

        }
        }
        conteudo.append("</select>");
        conteudo.append("</form>");

        That is the form I want to put the ondblclick event to work.

        And the JS Dialog:

        var okDialog = function(){
        //Aqui o this é o Dialog!!
        var dados = this.getData();
        var sel = Select(dados.selProf);
        var indice = sel.selectedIndex;
        alert(indice);
        //dados.getElementById("selProf").selectedIndex;
        Dom.get(this.idInput).value = sel.options[indice].text;
        this.hide();
        };
        var cancelaDialog = function(){
        this.cancel();
        };
        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}]
        }
        );

        // Objeto que irá manipular os handlers das chamadas AJAX das Dialogs.
        var dialogAjax ={
        successDialog:function(o){
        var resposta = o.responseText;
        this.setHeader("Escolha um professor:");
        this.setBody(resposta);
        this.render();
        //Registra o novo conteúdo!!! Só pode registrar depois de renderizar
        this.registerForm();
        this.show();
        },
        falhaDialog:function(o){
        //alert("Falhou a dialog...");
        simpledialog.show();
        },
        startAjax:function(args){
        YAHOO.util.Connect.asyncRequest('POST', 'montaDialog',
        dialogCallback,args);
        }
        }
        var dialogCallback ={
        success:dialogAjax.successDialog,
        failure:dialogAjax.falhaDialog,
        scope:dialogProfessores
        };

        I hope you can understand this mess =)

        --- In ydn-javascript@yahoogroups.com, dav.glass@... wrote:
        >
        > Daniel --
        >
        > Can you post some code? It's easier to debug when we can see it in
        action :)
        >
        > Dav
        >
        > Dav Glass
        > dav.glass@...
        > blog.davglass.com
        >
        >
        > + Windows: n. - The most successful computer virus, ever. +
        > + A computer without a Microsoft operating system is like a dog
        > without bricks tied to its head +
        > + A Microsoft Certified Systems Engineer is to computing what a
        > McDonalds Certified Food Specialist is to fine cuisine +
        >
        > ----- Original Message ----
        > From: Daniel Nunes <jaywalker1983@...>
        > To: ydn-javascript@yahoogroups.com
        > Sent: Monday, April 30, 2007 9:58:31 AM
        > Subject: [ydn-javascript] Dialog issue
        >
        > Hi to all,
        >
        > I got a question, I think it is a bit simple to solve but I couldn't
        > manage to make it work. When you create a dialog dynamically and wants
        > an event to form its submission(script way) how could you do that?
        >
        > Example: I create a form dynamically for my Dialog and attach a
        > ondblclick event on a select tag to send the responde via-script to my
        > page but I'm having a hard time to do that. Does anyone knows how to
        > do that?
        >
        > Thanks!
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.