Path: csiph.com!1.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Interesting form functionality difference Date: Fri, 15 Jul 2016 08:27:23 +0200 Organization: PointedEars Software (PES) Lines: 55 Message-ID: <2767618.5fSG56mABF@PointedEars.de> References: <5aIhz.240$9n.232@fx38.iad> <87twfsr18i.fsf@bsb.me.uk> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1468564044 4921 eJwFwYEBwCAIA7CXBrRlnKMi/59gwpDpJESBw8lR1Rd7UqELX/cE231F7U7C41eDx4REWz0P5hBT (15 Jul 2016 06:27:24 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Fri, 15 Jul 2016 06:27:24 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwFwYEBwDAEBMCVCP9iHCX2H6F3MCo7nKBjsR7V58VoS+d3gRvKFBXwZRqmvOgvw0ZNdjqrcUwjmNydHzsQFOo= Cancel-Lock: sha1:PaxxLku8XJkI0LO5aSMVosic1xo= X-NNTP-Posting-Host: eJwNysEBwCAIA8CVoJgYxqFU9h/B3vsQdPZeBBcG0zqP6m1wD2TupVSaFKhT0S1fNObn+GPYBRPDEE8= Xref: csiph.com comp.lang.javascript:30868 Ben Bacarisse wrote: > Robert Baer writes: >> The form in my page http://www.oil4lessllc.com/index-4.html works >> perfectly IF AND ONLY IF one is online. >> Copy all of the supporting folders and files, and the user-visible >> attributes look the same, but the entries do not get received. >> >> Any ideas as to why? > > At first glance it looks like the form is handled by PHP using a > relative URL. Unless you are running a PHP compatible server locally > (and your use of the phrase "all of the supporting folders and files" > suggests you are not) then it can't work offline. > > You could try changing > > mailHandlerURL:'bat/MailHandler.php' > > to > > mailHandlerURL:'http://www.oil4lessllc.com/bat/MailHandler.php' > > so the same PHP resource is used even when the pages are just local > files. … *and* they are running on a local Web server. Otherwise this is pointless. However, if submission fails because the server is temporarily unavailable, the submit event listener should store the form data in a cookie or in local storage for later submission. A session token in the data can make sure that ill-formed or outdated data is handled appropriately then. > It's a shame that this is all done using client-side scripting. You'd > get a very much more obvious error if the form element had an action > attribute. Client-side scripting should really only be used to add > features that assist the user, rather than being responsible for basic > functionality like submitting the form. It can be prudent to submit a form via scripting (example: see above), but there should be a no-script fallback. Error messages should be conveyed to the user by document modification or window.alert() anyway; technical details can be conveyed to the developer via the script console and cross- origin requests. > But, as I say, first glance. And you have hundreds of lines of script. Not really. -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.