[Slightly OT] Dealing with lost connections

Hi! I know that the web is essentially stateless, so I was wondering
about how lost connections can be managed.

I have an application that posts data to a web form. This form has a
large number of items (about 38) and I’m a bit concerned about the
connection being lost while posting the data. Is it safe to assume that
the web application will reject the transmission if the right number of
data bytes is not received from the client? (The POST header stores the
length of the content)

Is there anything else that I can do to make it robust?

Thanks
Mohit.

Simply do validation on the inputs. If all 38 of them are supposed
to be there, then use validates_presence_of, and return the page to
the user to fix if something’s missing. But to your underlying
question, the user hitting submit twice after not getting a quick
response is a much, much bigger issue than POSTs getting cut off
during transmission.

        - dan


Dan K. mailto:[email protected]
http://www.dankohn.com/ tel:+1-415-233-1000

I still see lots of sites say “Please only click once”. You really
don’t want to move the essential questions to the bottom. That’s bad
UI design. If you’re so worried about partial forms, create a 39th
hidden field at the bottom, and the validate for the presence of that
one.

        - dan


Dan K. mailto:[email protected]
http://www.dankohn.com/ tel:+1-415-233-1000

Dan K. wrote:

Simply do validation on the inputs. If all 38 of them are supposed to
be there, then use validates_presence_of, and return the page to the
user to fix if something’s missing. But to your underlying question,
the user hitting submit twice after not getting a quick response is a
much, much bigger issue than POSTs getting cut off during transmission.

       - dan

–Dan K. mailto:[email protected]
http://www.dankohn.com/ tel:+1-415-233-1000

Hi Dan,

Thanks for the pointers… a number of those parameters are not
essential, but I can move the essential parameter to the end of the list
and use validates_presence_of on that parameter to try to ensure that it
seems to be working!

As for submitting twice, in this specific application, I don’t have to
worry too much about that since the submission is being done
automatically by my own program and I can control that to some extent
:slight_smile: What is the general practice to avoid having double submissions? I
notice that some of my preferred sites use Javascript to disable the
button once submit has been clicked… if JS is disabled, then that
doesn’t work (but I guess they assume that most people who disable JS
themselves know better than to submit it twice!)

Cheers
Mohit.

Dan K. wrote:

I still see lots of sites say “Please only click once”. You really
don’t want to move the essential questions to the bottom. That’s bad
UI design. If you’re so worried about partial forms, create a 39th
hidden field at the bottom, and the validate for the presence of that
one.

       - dan

–Dan K. mailto:[email protected]
http://www.dankohn.com/ tel:+1-415-233-1000
Hi Dan,

As always, thanks for the good advice… It’s a good point that we
should not move the essential items to the bottom… but, like I said,
in my case, the form is submitted automatically by a piece of software.
So, I have the flexibility to format the POST string to place the item
right at the end irrespective of the position of the question in the
UI. (In fact, in my case, the user will not often see the data before
it is submitted) :slight_smile:

But, I appreciate your concern and I do agree the hidden field makes a
nice simple option!
Cheers
Mohit.