Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / November 2005

Tip: Looking for answers? Try searching our database.

javascript post

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve - 15 Nov 2005 18:56 GMT
I am having trouble posting a form through javascript.  It seems to post, but
it posts to the directory and not the page.   It also does the same if I try
to click a button through javascript (However, if I click the button
directory, it works fine).

I'm using Asp.Net 2.0. Here's the form tag:

form name="aspnetForm" method="post" action="MlsNumberSearch.aspx"
onkeypress="javascript:return WebForm_FireDefaultButton(event,
'ctl00_cb_btnHandleEnterKey')" id="aspnetForm">

Here's the javascript:

function TestHiddenButton()  {               
                                  alert(document.forms[0].action)      //This works fine!
alert(document.forms[0].method)   //This works fine!
alert(document.forms[0].name)      //This works fine!
document.forms[0].submit()          //This does not post directly to the
form!??
}

Does anyone know why it's not posting correctly? Your help is greatly
appreciated!!!

Signature

Steve

Steve - 16 Nov 2005 22:09 GMT
I am still having the problem, but I think I'm starting to somewhat narrow
this down.  The code in my previous post still does NOT work, but if I submit
the page when the page loads (see example below), the page submits perfectly.
The code looks like this:

<script language="javascript" type="text/javascript">
//ok, let's try it this way...   
    document.forms(0).submit()
</script>

Could this be related to a XP SP2 security thing?   Any help is greatly
appreciated!!!

Signature

Steve

> I am having trouble posting a form through javascript.  It seems to post, but
> it posts to the directory and not the page.   It also does the same if I try
[quoted text clipped - 19 lines]
> Does anyone know why it's not posting correctly? Your help is greatly
> appreciated!!!
Steve - 17 Nov 2005 20:28 GMT
I finally figured out the problem!!! The href attribute MUST have something
in there, even if it's dummy data for the data to post.

This:

[code]
<a href="" onclick="javascript:ClickButton()">Click me to submit the page
through clicking the button</a>
[/code]

should be:

[code]
<a href="#DUMMY" onclick="javascript:ClickButton()">Click me to submit the
page through clicking the button</a>
[/code]

Signature

Steve

> I am still having the problem, but I think I'm starting to somewhat narrow
> this down.  The code in my previous post still does NOT work, but if I submit
[quoted text clipped - 32 lines]
> > Does anyone know why it's not posting correctly? Your help is greatly
> > appreciated!!!

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.