IE: Access is Denied when posting form using javascript!

P

pbd22

Hi.

Why is this happening??
I have a reg form with a lot of data.
I am trying to post the form using

document.getElementById('id').submit();

I am explicitly naming method="post" in my form tag.
the action element is pointing to the same form:

action="sameform.aspx".


I am using about 20 hidden input fields.

<input type=hidden id=hidden1 value=title />

The inputs get their values via javascript on client validation:

<a href='#' onclick="return validclient();" id="publish"
class="textBtnRed"><span>Publish</span></a>

I am getting "Access is Denied" no matter what I seem to do.
Could somebody please either give me an idea how to get around this
and/or
please give me an example of how to post a large amount of data using
javascript (I cannot use
Microsoft's runat=server per the client's request.

Thanks!
 
T

Thomas 'PointedEars' Lahn

pbd22 said:
Why is this happening??

There is no `this' to know about at this point. Don't assume that your
readers (can) read the Subject before they read the message body.
I have a reg form with a lot of data.
I am trying to post the form using

document.getElementById('id').submit();

It's not a good idea to give an element an ID of `id'.
I am explicitly naming method="post" in my form tag.
the action element is pointing to the same form:

`form' _element_, `action' _attribute_
action="sameform.aspx".


I am using about 20 hidden input fields.

<input type=hidden id=hidden1 value=title />

Avoid XHTML.

http://hsivonen.iki.fi/xhtml-the-point/
http://hixie.ch/advocacy/xhtml
http://www.spartanicus.utvinternet.ie/no-xhtml.htm
The inputs get their values via javascript on client validation:

<a href='#' onclick="return validclient();" id="publish"
class="textBtnRed"><span>Publish</span></a>

Why the `span' element? The `a' element has an `id' and a `class'
attribute; that should suffice for formatting its content.

Anyway, you should use

<form ... onsubmit="return validclient()">
...
</form>

and a submit button instead.
I am getting "Access is Denied" no matter what I seem to do.

Another common cause could be your having a control named `submit' within
that form. That would overwrite the built-in submit() method of the form
object.


PointedEars
 
V

VK

Hi.

Why is this happening??
I have a reg form with a lot of data.
I am trying to post the form using

document.getElementById('id').submit();

I am explicitly naming method="post" in my form tag.
the action element is pointing to the same form:

action="sameform.aspx".

I am using about 20 hidden input fields.

<input type=hidden id=hidden1 value=title />

The inputs get their values via javascript on client validation:

<a href='#' onclick="return validclient();" id="publish"
class="textBtnRed"><span>Publish</span></a>

I am getting "Access is Denied" no matter what I seem to do.
Could somebody please either give me an idea how to get around this
and/or
please give me an example of how to post a large amount of data using
javascript (I cannot use
Microsoft's runat=server per the client's request.

Thanks!

In order to send form control data to the server you have to set NAME
property to the said form control. A form control w/o NAME property is
still scriptable but its data is not used for form submission.
Respectively NAME is _absolutely_ _obligatory_ attribute for any
submissible form element and ID is _non-obligatory_ additional
attribute sometimes needed if one wants to use some special client-
side scripting on form elements. After this HTTP basic is set, the
rest is really simple...
 
T

Thomas 'PointedEars' Lahn

VK said:
[...] ID is _non-obligatory_ additional attribute

And what would that be? Certainly not a required one, because it isn't.
sometimes needed if one wants to use some special client- side scripting
on form elements. [...]

Nonsense. Collections work with names, too, and they work better then.


PointedEars
 
P

pbd22

I have to use the silly anchor tag to submit the form but I am
realizing that when I submit
with the anchor tag, the form's onsubmit attribute doesn't fire. How
can I submit with the
anchor tag and get the "onsubmit" attribute of the form to fire?

Peter
 
T

Thomas 'PointedEars' Lahn

pbd22 said:
I have to use the silly anchor tag to submit the form
^^^^^^^^^^^ anchor _element_, if that

Why? I don't think so. In fact, you really don't want it as it does not
degrade gracefully. It's not just silly, it's does not comply with
accessibility guidelines, which is a killer criterion in many countries.
but I am realizing that when I submit
with the anchor tag, the form's onsubmit attribute doesn't fire. How
can I submit with the
anchor tag and get the "onsubmit" attribute of the form to fire?

You can always execute the code there "manually", before calling submit().

But don't you miss the point of your problem?


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top