[semi-OT]simulating onSubmit in post
Devin Asay
devin_asay at byu.edu
Wed Feb 24 17:19:07 EST 2010
Thanks, Graham, Martin and Jim for your thoughtful and most helpful
replies. Let me respond to a few of your points.
On Feb 24, 2010, at 2:26 AM, Graham Samuel wrote:
>
> I for one don't think this is OT at all: I have struggled to
> understand how to extract stuff from web sites in a more complicated
> way than the simple examples given in the Rev documentation. I got a
> lot of help from this list (especially from SparkOut <sparkoutyny at gmail.com
> >) but I still remain profoundly ignorant. For instance, I wanted to
> know in a similar situation if I could effectively by-pass the JS
> function while capturing the web-based data and then replicate its
> functionality within my Rev program. IMHO anything that sheds light
> on the kind of topic would help strengthen the use of Rev in the
> area of interacting with web services, so must be of interest to
> many Revvers.
Since I am teaching my students about this topic this year, I am
trying to distill what I am learning on my revolution.byu.edu web
site. I have posted the following inter-linked pages that deal with
GET and POST and Rev:
http://revolution.byu.edu/internet/webServices.php
http://revolution.byu.edu/internet/webServicesTerms.php
http://revolution.byu.edu/internet/getMethodSteps.php
http://revolution.byu.edu/internet/postMethodSteps.php
http://revolution.byu.edu/internet/aboutForms.php
I hope that others may find them informative (and that others won't be
shy about pointing out errors if they find them.)
On Feb 24, 2010, at 2:39 AM, Martin Baxter wrote:
> In the url instanced below, unless I'm misunderstanding what you are
> trying to do, if you make a properly formed POST direct to
> someurl.htm?loadpage, direct from a script or a stack for instance,
> the
> onSubmit event in the html form is almost certainly irrelevant,
> because
> it is only triggered in the browser when the user clicks the submit
> element, and wouldn't apply in other cases.
>
> Have you experienced some issue that makes you think it is relevant?
< Comments about JS client-side vs. server-side validation clipped.>
Thanks, Martin. That is what I suspected, but being a JS novice, it
was helpful to have it confirmed. I had thought I had carefully parsed
the form tag on the page in question and replicated the required
arguments in my stack. However I still couldn't get the server to
respond with the desired information. As it turns out then, the
validation function was a red herring, and I discovered the problem
after reading Jim Ault's enlightening reply. He gave a very helpful
summary of various types of validation using server-side forms, client-
side JavaScript, and AJAX server-side "live-typing" validation.
But this bit of advice is what helped me find my error:
On Feb 24, 2010, at 3:58 AM, Jim Ault wrote:
> server-side FORM
> The way I use is to go into FireFox, activate the add-on using menu
> Tools:Live HTTP Headers, fill in the form, then capture the headers
> that are send by the browser. The headers will include the GET and
> POST data (of course). Now you can use Rev to manipulate the Headers
> (see the Rev dictionary) before submitting a form.
Once I installed Live HTTP Headers in Firefox, I could clearly see
that I had failed to find some of the required arguments when I first
looked through the form tag in the page source. I went back to the
page source, and sure enough, found some hidden inputs that the page
author had included after the submit input, but before the closing "</
form>" element. Nearly all of the other forms I've looked at have the
submit input as the very last element in the form. So what tripped me
up was a (to me at least) oddly-written form element in the page
source. Thanks, Jim, for the tip on a very helpful tool.
And thanks again everyone for your help.
Regards,
Devin
Devin Asay
Humanities Technology and Research Support Center
Brigham Young University
More information about the use-livecode
mailing list