Hi Nicholas,

the problem you mention is I think not a JS problem, because all
instruction runs in order.
The problem is more a network one.

What I mean is when you submit the form, I understand that just after
you send the AJAX request to see if everything is well done.
The problem here is that you don't know which request could achive to
the server first (surprise !)


> Thanks for looking at this.... and not laughing tooo hard... :)

If you had this problem how could you be sure that noone has the
same :))


>
> function updateStationDetails()
> {
>
>         var org_code = $F('ORG_CODE');
>
>        // shouldn't we know this block is done before moving on??

The only problem here is if youre ID doesn't exist, so check the
returned value !


>
>         $('DETAILS_FORM').writeAttribute({method:"post",
> action:"updateStation.cfm", target:"RSIFrame"});
>         $('DETAILS_FORM').insert(new Element("iframe", {id: "RSIFrame", name:
> "RSIFrame", style: "width: 0px; height: 0px; border: 0px;", src:
> "blank.html"}));
>         $('form').submit();
>
>        // end non communicating block

Big mistake  ==> thge $('form').submit(); IS A COMMUNICATION block as
it send the form value to the server !


>
>       // this block needs to hang out until the above is done
>
> new Ajax.Request('editStation.cfm?ORG_CODE='+org_code+'&'+cfSession,
>       {
>         method: 'get',
>         onSuccess: loadStationDetails,
>                 onComplete: attachStationObservers,
>         onFailure: function(r) {
>           throw new Error( r.statusText );
>         }
>       }
>     );
>
> }


==> My advise is to change the $('form').submit(); - Do like this:
1- retrieve the value you have in the form
2- send an AJAX request to replace the submit and if every thing is
good in server side, just respond with a clear message
3- As you does in the AJAX;request, just verify on Complete, onFailure
and accordingly do what you have to

hope I answer you question !

--
david

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to