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

RE: [ydn-javascript] Re: Problem with Dialog and Ajax posts (2.5.1)

Expand Messages
  • Hema Ramar
    Hi Bret Matias, May be you can help me. I am having problem with Dialog Submit. My Dialog form is here. If I just use this handlesubmit(in the example), it
    Message 1 of 4 , Apr 30, 2008

      Hi Bret\ Matias,

       

      May be you can help me. I am having problem with Dialog Submit.

       

      My Dialog form is here…  If I just use this handlesubmit(in the example), it doesn’t work. If I override handle success with the “YAHOO.util.Connect.asyncRequest('GET', sUrl, { success:handleSuccess, failure:handleFailure })” it works fine.

       

      <div id= dialog>

        <div class="hd">Please enter the $!{panel} value</div>

            <div class="bd">

                  <form method="POST" action="/metis/VariosAJAXServlet">

                        <label for="textarea"></label>

                        <textarea

                              name="content"

                              rows="4"

                              cols="25" >

                        </textarea>

                  </form>

      </div>     

       </div>

       

      var handleSubmit = function() {

        this.submit;

      }

       

       

      My handle success method

       

       var handleSubmit = function() {

            var data = this.getData();

            var configurationVal = data.content;

            var configurationKey = $!{key};

            var entryPoint = '/metis/VariosAJAXServlet';

      var queryString = encodeURI('?SAFAJAXAction=updateConfigurationByConfigurationTypeAndConfigurationKey&configurationTypeName=METIS_VALUE_DEFINITION&configurationKey='+configurationKey+'&configurationValue='+configurationVal);

            var sUrl = entryPoint + queryString;

       

            YAHOO.log("Submitting request; zip code: ");

            var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, { success:handleSuccess, failure:handleFailure })           

      };

       

      Could you please let if I

       

       

       

       

       

       


      From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of matiasnu
      Sent: Wednesday, April 30, 2008 8:51 AM
      To: ydn-javascript@yahoogroups.com
      Subject: [ydn-javascript] Re: Problem with Dialog and Ajax posts (2.5.1)

       

      Hi Bret and thanks for your reply,

      I solved it the minute after I posted my question.

      My dialog has a callback success handler which injects the response HTML into the dialog.
      I simply added the following code to my handleModalSuccess function:

      myDialog.form = document.getElement ById("popupForm" );

      And it seems to work great.

      Best regards,
      Matias

      --- In ydn-javascript@ yahoogroups. com, "bretlevy" <bret@...> wrote:

      >
      >
      > Matias,
      >
      > Can you post a link to the page? It sounds like you have a solvable
      > problem, but i (or anyone else) probably needs to see the details of
      > your implementation to give specifics.
      >
      > At first reading, it sounds like you might end up with two forms in
      > your DOM, which culd explain why the "wrong" form's value are
      being
      > found. That's just a wild guess though.
      >
      > ~~bret
      >
      >
      >
      > --- In ydn-javascript@ yahoogroups. com,
      "matiasnu" <matiasnu@>
      > wrote:
      > >
      > > Hi everyone,
      > >
      > > I'm having some trouble with the dialog control and my
      > form "popupForm".
      > >
      > > The first time I post the form to the server everything works
      > great. I validate the form and
      > > If one of the fields was not correct I re-load the form and fields
      > in the dialog using ajax .
      > >
      > > The user corrects the field and submits the form again, but the
      > submitted values are the
      > > same ones from the "previous" form.
      > >
      > > If I debug and break on doSubmit (container-debug. js row 6264)
      > using Firebug, I can see
      > > that document.getElement ById("popupForm" ).elements[ "field1"] .value
      > contains the new,
      > > corrected value but oForm.elements[ "field1"] .value
      contains the
      > previous value which gets
      > > posted again.
      > >
      > > So the problem seems to be that oForm doesn't point to the new
      w:st="on"> ajax-
      > created form, but to
      > > the old version of the form.
      > >
      > > One solution could be to, somehow, reset oForm when I load the new
      > form html into the
      > > dialog with ajax ,
      but how do I do that?
      > >
      > > Best regards,
      > > Matias
      > >
      >

    Your message has been successfully submitted and would be delivered to recipients shortly.