right track -- I appreciate the feedback which got me to this point.
The suggestions posted here indeed worked and eliminated the JavaScript
errors I was seeing. The fact that the target URL didn't execute was
because certain variables weren't being passed to it.
What I need to do is to pass a conditional variable to the target URL,
when the form is submitted, depending on which graphic button is pressed.
So, the form already sends several variables when the form is submitted
(at the onclick event). I've confirmed this by capturing the HTTP POST
variables and displaying them when the page executes.
Now, depending on which graphic button is selected, I would like to pass
another variable.
For example, when the Create button is pressed, I would like to pass
create=true (or something signifying that 'create' is set) to the target
URL.
How would I accomplish this? Any suggestions?
- Orest
On 2003-08-27 11:38 PM, Orest Kinasevych Saj remarked:
I'm trying to use images as form submit buttons along with JavaScript
but am having trouble getting these to work correctly. JavaScript
isn't one of my strengths.
Here's the current incarnation of my form and script (stripped to the
essentials):
----
<form name='frmcontact' method='post' enctype='multipart/form-data'>
Name:<input name='fname' type='text' size='10' value=''>
<input type='image' name='create' src='save.gif'
onclick='document.form.action="contacts.php"'>
</form>
----
The form executes correctly -- ie, all parameters are passed to the
target URL and processed correctly. (Not shown here in the interest
of simplicity are several input items of type=hidden. None of those
inputs has a name or value of 'action'.)
The problem is that IE and Mozilla complain of a JavaScript error.
The following error appears in IE6/Win:
----
'document.form' is null or not an object
----
The Mozilla JavaScript debugger reports the following error:
----
document.form has no properties
----
I've tried several variations and have consulted all requisite
resources for guidance, all to no avail.
Please help!