well, the code works perfectly on normal views, just fails when
creating the pop-up window... so, i'm wondering if the view is loading
correctly there ( if the jquery code is loading correctly )...
do you have any working example? something you had try and really
work? then i would like to take a look.
thanks

Rohman

On Sep 18, 5:26 pm, Bert Van den Brande <[email protected]> wrote:
> Can't find anything that would trigger the described behavior, though I must
> say the code is a bit difficult to read ;)
>
> Maybe step through the javascript code using FireBug and try to detect at
> what point the page is reloaded ?
>
> 2009/9/18 浪漫様 <[email protected]>
>
>
>
> > that should be the view
>
> > <div id="formularioajax">
> >  <form id="PreguntaResponderForm">
> >    <?=$form->textarea('Pregunta.texto',array('rows' => 5,'cols' =>
> > 50)); ?>
> >  <?=$form->end($mb->localizacion("botonEnviar", $idiomaUsuario)); ?>
> > <?=$mb->formularioAjax("formularioajax", "pregunta", "responder",
> > $idPregunta."/".$tipoRespuesta, array("texto"));?>
> > </div>
>
> > 'mb' is a helper, whose 'formularioAjax' creates the ajax form:
>
> > /* Creacion de un formulario que se enviara por JQuery */
> >  function formularioAjax($divId, $controlador, $funcion, $parametros,
> > $campos, $callbacks = null) {
> >    $output = "";
> >    $output.= '<script type="text/javascript">';
> >    $output.=  '$(function(){';
> >    $output.=    '$("form#'.ucfirst(strtolower($controlador)).ucfirst
> > (strtolower($funcion)).'Form").submit(function() {';
> >    foreach ($campos as $item) {
> >      $output.= 'var '.$item.' = $("#'.ucfirst(strtolower
> > ($controlador)).ucfirst(strtolower($item)).'").attr("value");';
> >    }
> >    $output.=       '$("#'.$divId.'").html($.ajax({';
> >    $output.=         'type: "POST",';
> >    $url = "/".strtolower($controlador)."s/".strtolower($funcion);
> >    if ($parametros != '') {
> >      $url.= "/".$parametros;
> >    }
> >    $output.=         'url: "'.$url.'",';
> >    $datos = "";
> >    foreach ($campos as $item) {
> >      $datos.= '+"&datar['.ucfirst(strtolower($controlador)).']['.
> > $item.']="+'.$item;
> >    }
> >    $output.=         'data: "'.substr($datos, 3).',';
> >    if ($callbacks != '') {
> >      $output.=       'complete: function() {'.$callbacks.'},';
> >    }
> >    $output.=         'async: false';
> >    $output.=       '}).responseText);';
> >    $output.=       'return false;';
> >    $output.=     '});';
> >    $output.=   '});';
> >    $output.= '</script>';
> >    return $output;
> >  } // function: formularioAjax
>
> > it works perfectly on a simple view... but not in the pop-up div
> > thanks
>
> > Rohman
>
> > On Sep 18, 5:03 pm, Bert Van den Brande <[email protected]> wrote:
> > > Sorry, but it still sounds to me that the form inside your popup is being
> > > submitted like a normal form.
>
> > > Maybe show some code ?
>
> > > On Fri, Sep 18, 2009 at 10:58 AM, 浪漫様 <[email protected]> wrote:
>
> > > > walther, thanks for the reply... but i guess you didn't read well my
> > > > post neither...
> > > > I'm able to send the form with ajax ( also using AjaxForm ) from a
> > > > single view without any problem... the problem comes when you try to
> > > > do it from a facebook style div-window that pops up...
> > > > imagine i am reading a post and i want to send the comment with an
> > > > ajax form... yes... that works without any problem, the form is
> > > > already located on the main ( post ) view, and form is sent and
> > > > comments div is updated... no problem.
> > > > now imagine you are building a facebook-alike social networking, and
> > > > when clicking on a user's 'send message to xxx' link i want to open a
> > > > pop-up ajax window to send message to him... but not from the main
> > > > view's form... from a form located on a div appearing on screen ( i
> > > > guess you are familliar with facebook or other sites that do that )...
> > > > then the form is sent, but the page is reloaded while what i want is
> > > > to refresh the ajax-window div. ( that's the problem )
> > > > thanks
>
> > > > Rohman
>
> > > > On Sep 18, 4:49 pm, Walther <[email protected]> wrote:
> > > > > Take a look at the AjaxForm plugin for jQuery. You need to submit the
> > > > > form using AJAX as well.
>
> > > > > On Sep 18, 10:15 am, 浪漫様 <[email protected]> wrote:
>
> > > > > > i don't think that is the problem... facebook can do it without
> > > > > > iFrames and works perfectly no matter what browser.
> > > > > > moreover... i'm talking about same domain's forms... nothing to do
> > > > > > with external domains.
> > > > > > if i'm building a facebook-alike social networking, and when
> > clicking
> > > > > > on a user's link i want to open a pop-up ajax window to send
> > message
> > > > > > to him... where is the cross-domain issue?
> > > > > > thanks for the reply : ) just i think you confuse the topic
>
> > > > > > Rohman
>
> > > > > > On Sep 18, 3:50 pm, wirtsi <[email protected]> wrote:
>
> > > > > > > I think you are running into the "same-origin-issue" ... most
> > > > browsers
> > > > > > > only allow ajax-requests so the same domain. Check out this
> > > > posthttp://www.petefreitag.com/item/703.cfm
>
> > > > > > > With iframes you can post data freely to any other domain. I'd
> > just
> > > > > > > like to mention here, that if you want to post uploaded files,
> > you'll
> > > > > > > also need an iframe form since you can't upload files via ajax
> > calls
>
> > > > > > > On 18 Sep., 09:12, 浪漫様 <[email protected]> wrote:
>
> > > > > > > > hello all,
> > > > > > > > i had been successful on sending forms via ajax on a view and
> > > > updating
> > > > > > > > some divs instead of reloading the page without much problem,
> > > > however,
> > > > > > > > when the form is located on a facebook-like ajax pop-up div,
> > the
> > > > page
> > > > > > > > is always reloaded on submission... and that's not what i
> > > > expected...
> > > > > > > > i found a solution that is to place an iFrame with the ajax
> > form
> > > > > > > > inside the ajax window... however, i would like to be able to
> > do it
> > > > > > > > without iFrames... just like facebook or other sites does.
>
> > > > > > > > do somebody know any way to accomplish that? all examples,
> > codes,
> > > > > > > > etc... i had been trying or finding online ( even using JQuery
> > > > plug-
> > > > > > > > ins like Boxy, or doing it myself with same result ) has the
> > same
> > > > > > > > behavior... so i can not do data validation on ajax
> > div-window's
> > > > forms
> > > > > > > > or just simply send a 'whatever action done' message after
> > > > submission.
>
> > > > > > > > thanks in advance.
>
> > > > > > > > Rohman
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to