473,216 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,216 software developers and data experts.

JavaScript and Automating form submission

weird subject - i hope more than just one curious regular will hear me out.
:)

ok, i've got a bit of a big problem, and i need answers as soon as
possible.

i know this forum is meant for web developers, but is relevant discussion.
i'm not OT here unless someone thinks i'm trolling (which i'm not,
obviously). then i'll disappear and never show my face again. :P

we are automating form submission using the MS IE 5 DOM through the
InternetExplorer object and have run against two major roadblocks: both of
which involve JavaScript and the DOM exposed in Internet Explorer, so i
hope someone can help out here.

first, and easiest, we will need to be able to upload files assosciated
with this form sumbission. we'd like to automate it, like everything else.
my question here is: how do we assign a file to an input field of type
"file" to upload it?

second, and more difficult: the forms use a validation script that ensures
proper content in the form. it's difficult to ensure all our data will
pass the validation, so we would like to be able to flag errors as they
come. the validation script scans the contents of the form and calls
window.alert() when an error is detected (i.e., missing data or incorrect
data type). after the alert(), focus() is given to the first field in
question. this problem is twofold: we need to detect the alert(), AND we
need to know which input field has focus. so how do we trap the alert(),
and how do we detect which field got focus()? (we do, in fact, have a
complete list of possible fields that may gain focus.)

any help would be greatly appreciated, even if it's "go away and ask this
in microsoft.public.inetsdk.*!" (unfortunately, that's the first place i
tried, and either no one knows or no one wants to answer.)

--
Charles Banas
Jul 20 '05 #1
6 4289
In article <op**************@news.cableone.net>, Charles Banas
<no****@myplace.net> writes:

weird subject - i hope more than just one curious regular will hear me out.
:)

ok, i've got a bit of a big problem, and i need answers as soon as
possible.

i know this forum is meant for web developers, but is relevant discussion.
i'm not OT here unless someone thinks i'm trolling (which i'm not,
obviously). then i'll disappear and never show my face again. :P

we are automating form submission using the MS IE 5 DOM through the
InternetExplorer object and have run against two major roadblocks: both of
which involve JavaScript and the DOM exposed in Internet Explorer, so i
hope someone can help out here.

first, and easiest, we will need to be able to upload files assosciated
with this form sumbission. we'd like to automate it, like everything else.
my question here is: how do we assign a file to an input field of type
"file" to upload it?
In normal security environments, you don't. Its off-limits to scripting. An
ActiveX *might* be able to, but never seen one that would that didn't require
down in the dirt, have your way with my PC security settings.
second, and more difficult: the forms use a validation script that ensures
proper content in the form. it's difficult to ensure all our data will
pass the validation, so we would like to be able to flag errors as they
come. the validation script scans the contents of the form and calls
window.alert() when an error is detected (i.e., missing data or incorrect
data type). after the alert(), focus() is given to the first field in
question. this problem is twofold: we need to detect the alert(), AND we
need to know which input field has focus. so how do we trap the alert(),
and how do we detect which field got focus()? (we do, in fact, have a
complete list of possible fields that may gain focus.)

any help would be greatly appreciated, even if it's "go away and ask this
in microsoft.public.inetsdk.*!" (unfortunately, that's the first place i
tried, and either no one knows or no one wants to answer.)


Pass a reference to the element to your function. If you are calling the
function from each field, onchange, instead of onchange="someFunction()", use
onchange="someFunction(this)" and it will tell the function, anonymously, what
element called it:

function someFunction(formField){
//validation here
if (passes){

}
else{
window.alert(.......)
formField.focus()
}
}

If the validation function is being called by the onsubmit handler, then it has
to go through all fields, and should know when the field fails, and be able to
know what field needs focus.

If none of this applies, doesn't help, or confuses you, post a very brief
sample page that shows the basics of the page you are actually using. URL
preferred to code.
--
Randy
All code posted is dependent upon the viewing browser
supporting the methods called, and Javascript being enabled.
Jul 20 '05 #2
On 29 Jul 2003 00:08:21 GMT, HikksNotAtHome <hi************@aol.com> wrote:
In normal security environments, you don't. Its off-limits to scripting.
An
ActiveX *might* be able to, but never seen one that would that didn't
require
down in the dirt, have your way with my PC security settings.
since we don't have time to develop such a plugin, do you know of one we
could use? or is it as impossible as it looks?

Pass a reference to the element to your function. If you are calling the
function from each field, onchange, instead of onchange="someFunction()",
use
onchange="someFunction(this)" and it will tell the function, anonymously,
what
element called it:
i guess i wasn't clear enough about it - this isn't our page we're
automating, so i can't really change anything on the page itself. :) it's
being done remotely though the InternetExplorer automation object. (which
really isn't all that good for automation.)
function someFunction(formField){
//validation here
if (passes){

}
else{
window.alert(.......)
formField.focus()
}
}
that is similar to how it's handled, but see attached the source.
information that could be considered "sensitive" has been changed. the
page itself remains unchanged.
If the validation function is being called by the onsubmit handler, then
it has
to go through all fields, and should know when the field fails, and be
able to
know what field needs focus.
unfortunately, that doesn't apply since you're assuming something i didn't
clarify enough. :P
If none of this applies, doesn't help, or confuses you, post a very brief
sample page that shows the basics of the page you are actually using. URL
preferred to code.


this is the most "brief" of the pages in question, and it should give you a
good idea what i'm dealing with.

the links are intentionally broken and names removed to protect the victim
(and possibly my job). :P
Jul 20 '05 #3
On Mon, 28 Jul 2003 16:50:20 -0600, Charles Banas <no****@myplace.net>
wrote:
i know this forum is meant for web developers, but is relevant discussion.
i'm not OT here unless someone thinks i'm trolling (which i'm not,
obviously). then i'll disappear and never show my face again. :P
I understood it was meant for discussing javascript, but what the
heck...
first, and easiest, we will need to be able to upload files assosciated
with this form sumbission. we'd like to automate it, like everything else.
my question here is: how do we assign a file to an input field of type
"file" to upload it?
just do fileelRef.value="moomin..." in a secure environment this
should be no problem.
second, and more difficult: the forms use a validation script that ensures
proper content in the form. it's difficult to ensure all our data will
pass the validation, so we would like to be able to flag errors as they
come. the validation script scans the contents of the form and calls
window.alert() when an error is detected (i.e., missing data or incorrect
data type). after the alert(), focus() is given to the first field in
question. this problem is twofold: we need to detect the alert(), AND we
need to know which input field has focus. so how do we trap the alert(),
and how do we detect which field got focus()?


Simply override the alert method with your own, which looks to see
what the message was. to catch which has focus, all I can see is to
overide each elements focus method... but it might be easier simply to
change the validation function to tell you directly...

How to override the functions and everything - look at
http://jibbering.com/snufkin/ which does it.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #4
On Tue, 29 Jul 2003 04:00:58 GMT, Jim Ley <ji*@jibbering.com> wrote:

How to override the functions and everything - look at
http://jibbering.com/snufkin/ which does it.
wait - are you sure that's what that page talks about?
Jim.


--
Charles Banas
Jul 20 '05 #5
On Tue, 29 Jul 2003 10:11:38 -0600, Charles Banas <no****@myplace.net>
wrote:
sorry - to clarify, i'm doing this in Access 97 through the
InternetExplorer "automatin" object. maybe i shouldn't have put
"JavaScript" in the subject....


Automating it with JS or VBA or whatever, the Object Model is the
same, and snufkin shows how to override window methods (not
window.alert specifically) but others to achieve what you want, making
them non-interactive, if you look at Snork an even older piece of code
knocking about on my site, I think you'll even see alert being
over-ridden.

Doing what you want is simple automating IE from JS, I'm sure it will
be simple from VBA too, but VBA is just a muppet language.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #6
On Tue, 29 Jul 2003 20:03:16 GMT, Jim Ley <ji*@jibbering.com> wrote:
On Tue, 29 Jul 2003 10:11:38 -0600, Charles Banas <no****@myplace.net>
wrote:
sorry - to clarify, i'm doing this in Access 97 through the
InternetExplorer "automatin" object. maybe i shouldn't have put
"JavaScript" in the subject....


Automating it with JS or VBA or whatever, the Object Model is the
same, and snufkin shows how to override window methods (not
window.alert specifically) but others to achieve what you want, making
them non-interactive, if you look at Snork an even older piece of code
knocking about on my site, I think you'll even see alert being
over-ridden.

Doing what you want is simple automating IE from JS, I'm sure it will
be simple from VBA too, but VBA is just a muppet language.

Jim.


i'll look it over more closely, then.

thanks

--
Charles Banas
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one...
8
by: Prometheus Research | last post by:
http://newyork.craigslist.org/eng/34043771.html We need a JavaScript component which will auto-submit a form after a set period has elapsed. The component must display a counter that dynamically...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
4
by: Ike | last post by:
Oh I must be missing somethign so simple and stupid. I need to do a submit() via an href, which I do (succesfully) in JavaScript in many other pages with <a...
10
by: ljlolel | last post by:
So.. I have a form that submits to an ASP.net site made in C-sharp. The ASP site is not mine, i do not have the server side code. When I submit from my form by pressing the Submit button, I get...
12
by: googlegroups | last post by:
Hi, I'm making a javascript program for rolling dice for a roleplaying game that's played in a forum. The die roll gets generated, gets stored as text in a hidden form field, and then gets written...
27
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
3
Plater
by: Plater | last post by:
I am having a spot of trouble with a little situation. I want to make the submit invisible on a submit so that the user cannot keep clicking on it while the server is receiving the file transfer....
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.