For the first time something is happening - though I am not sure what.
Explorer is hanging up after giving a 'null' response for the alert
below - but, firefox is not even hitting the alert and is processing
normally, thogh it does not have the code to complete the AJAX
request, just redirects to redo the original page. Can someone please
tell me what is going on????
<form method="post" id="formlinks" name="formlinks" action="Admin/
editmylinks2.php" onsubmit=$('formlinks').observe
('submit',validatethis);>
validatethis = function()
{
submitOK="true";
sometests...
if (((text1.length < 1 && url1.length > 0) || (text1.length > 0 &&
url1.length < 1)) || ((text2.length < 1 && url2.length > 0) ||
(text2.length > 0 && url2.length < 1)) || ((text3.length < 1 &&
url3.length > 0) || (text3.length > 0 && url3.length < 1))){
alert("If you enter link text, you must enter a URL and
vice-
versa");
submitOK = "false";
}
if (submitOK == "false"){
return false;
} else {
loadingScreen('MiddleContent','Loading...'); // working for IE;
firefox not getting here - is taking different route to process code
postIt('formlinks');
}
}
function postIt(theform) {
var form = $(theform);
alert (form); // as said, firfox not goingt here, but IE reports
'null' for this alert
form.request({
onComplete: function() { alert ('good') }
})
}
(I assume Firefox is just going directly to action of form, but do not
know why)
Ben
On Mar 10, 10:04 am, Bhudda Ben <[email protected]> wrote:
> Hi Quleczka
>
> All your suggestions look good and probably are great technique for
> getting this done. BUT, no matter what I do, no matter ghow I code
> this - and I have now tried at least a dozen different ways, I get the
> exact same problem - as soon as I address my form, I get an error -
> either firefox says the form has no properties or it just hangs at the
> place where I address (serialize, do form request, etc) the form. If
> I take AJAX out, and just let normal submission occur, correct
> processing occurs and I can reload the original page in its entirety
> (redirect). Normal AJAX Updater processing works, but as soon as I
> use a form... boom!!!
>
> I am at my wits end - I could experiment with doing this right aka
> some of your suggestions (and BTW - at first there was no 'good'
> response, just attempt to do what you suggest - load 'MiddleContent'
> directly from the form processor - but no form is working here. Could
> there possibly be some other conflict with jQuery or ???
>
> Thanks for your suggestions tho.
>
> Ben
>
> On Mar 9, 3:14 pm, Quleczka <[email protected]> wrote:
>
>
>
> > Hi,
>
> > First of all I'm not prototype expert, rather newbie ;)
>
> > 1) why do you use onsubmit="validatethis();"> if you can use $
> > ('formlinks').observe('submit',validatethis);
>
> > 2) you don't have to set asynchronous:true - it's default value
>
> > 3) most common is parameters: $('formlinks').serialize(true) than
> > using postBody
>
> > 4) use parameters: { dept: $F('dept'), reg: $F('reg') } instead of
> > this long postBody:'dept='+department+'®='+region ...this looks
> > really bad !!! ;)
>
> > you can also try to use $('formname').serializeElements( elements
> > selection go here)
>
> > for example $('formname').getInputs('text') which selects all input
> > textfields from the same form or something similar ...you can use
> > Element.select() or $$() if these elements have something in common
> > (like class, type etc.) - any group of elements can go into
> > serializeElements()
>
> > 5) where do you use mlprerresult variable? cause there is quite big
> > chance that you don't have this variable set by ajax request cause
> > before loadMenu() is called
>
> > 6) as far as I understand logic of this app it would be better to
> > call loadmenu(); inside reportresult(); than it's sure it is called
> > only after success of ajax request
>
> > 7) can't you get this data from 'site/traderhomecenter.php' or 'site/
> > adminhomecenter.php in response of first ajax request already? are
> > the values $F('mlptrader'); $F('mlpdepartment'); etc. from form
> > 'formlinks'?
>
> > if yes... you passed it all to the server already in first ajax
> > request ... so can't you make one more php file which will calls
> > 'Admin/editmylinks2' inside and instead of returning just 'good'
> > returns result of traderhomecenter.php or adminhomecenter.pl? or just
> > change editmylinks2 to return this?
>
> > you can send "good" if you want is x-json header of the same ajax
> > response and in the body you can send html which you want to use to
> > update " MiddleContent'
>
> > simple example of php
> > --------------
> > $response = array ('good'=>true);
> > header('X-JSON: ('.json_encode($response).')');
> > if ($_POST('mlptrader'))
> > die (variable with html you get from traderhomecenter);
> > else
> > die (variable with html you get from adminhomecenter);
> > ----------------
> > and then in javascript
>
> > function reportresult(transport) {
> > var good = transport.headerJSON.good;
> > if (good){
> > document.getElementById("mlprerresult").innerHTML =
> > 'Your request
> > completed successfully';
>
> > //instead of ajax updater just update $('Middle Contect').innerHTML
> > here with what you have in transport.responseText
> > }else
> > document.getElementById("mlprerresult").innerHTML =
> > 'Your request
> > failed!!!';
> > -----------------
>
> > These are my thought to make it easier but I'm not sure I understand
> > correctly logic of your application.
>
> > Quleczka- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---