Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #30868

Re: Interesting form functionality difference

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Interesting form functionality difference
Date 2016-07-15 08:27 +0200
Organization PointedEars Software (PES)
Message-ID <2767618.5fSG56mABF@PointedEars.de> (permalink)
References <5aIhz.240$9n.232@fx38.iad> <87twfsr18i.fsf@bsb.me.uk>

Show all headers | View raw


Ben Bacarisse wrote:

> Robert Baer <robertbaer@localnet.com> 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: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Interesting form functionality difference Robert Baer <robertbaer@localnet.com> - 2016-07-14 00:36 -0800
  Re: Interesting form functionality difference Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-14 10:57 +0100
    Re: Interesting form functionality difference Robert Baer <robertbaer@localnet.com> - 2016-07-14 17:40 -0800
      Re: Interesting form functionality difference Robert Baer <robertbaer@localnet.com> - 2016-07-14 18:03 -0800
    Re: Interesting form functionality difference Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-15 08:27 +0200
      Re: Interesting form functionality difference Robert Baer <robertbaer@localnet.com> - 2016-07-16 19:47 -0800
        Re: Interesting form functionality difference Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-17 20:31 +0200
          Re: Interesting form functionality difference Robert Baer <robertbaer@localnet.com> - 2016-07-19 20:27 -0800
            Re: Interesting form functionality difference Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-24 18:40 +0200

csiph-web