Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 7th, 2006, 11:31 AM
Authorized User
 
Join Date: Dec 2005
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to submit a form and post java script variable

hello,
please i want ur help in this problem: a variable that must be sent in the button to a page and the button itself has to submit the form to the same page ?
i have this code :
<form name="frmadd" action="Partupdate2.asp" method="post">

<input type="submit" value=" Edit " name="cmdsave" size=70 onclick="window.location='partupdate2.asp?ID2=<%=r s("id")%>';">

this code doesn't make the submittion, it just redirect the variable to the page

 
Old February 10th, 2006, 07:59 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The button can only do one thing. If you tell it to change the browser location when you click, that's what it will do, even if it's a submit button.

This isn't a very ASP.NET way of doing what you are doing.

You'd probably be better to use a regular asp button, do what you need when the form submits (in the button click handler) and then use Response.Redirect() to send the user to the new page.

-Peter
 
Old July 14th, 2006, 09:28 PM
Authorized User
 
Join Date: Aug 2003
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I know I'm *real* late here but couldn't resist.
It looks like you want to put the QueryString variable in the action of the form.

<form name="frmadd" action="Partupdate2.asp?ID2=<%=rs("id")%>" method="post">

Alternatively you could just add a hidden form field which is what I usually do:
<form name="frmadd" action="Partupdate2.asp" method="post">
<input type="hidden" name="ID" value="<%=rs("id")%>">

Hey, maybe somebody will find it valuable:o)






Similar Threads
Thread Thread Starter Forum Replies Last Post
ASSIGNING A JAVA SCRIPT VARIABLE TO A XSL VARIABLE SOMANATHAN10 XSLT 1 February 21st, 2007 04:26 AM
pass java variable to xsl variable kathy1016cats XSLT 1 June 14th, 2006 06:23 PM
How to connecting java script form to xml file ashraf Javascript How-To 1 December 10th, 2004 05:47 AM
How can we submit a form without a submit butto phpsharma BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 4 October 20th, 2003 08:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.