473,652 Members | 3,059 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting info out of a form's submit method

PJ6
When I have client-side script like this -

document.forms[0].submit('test')

how do I access, from server-side code, the value I put in the submit
method?

Also, is it possible to get the control's containing form name so I can
emite script like this -

document.SomeFo rmName.submit(' test')

so I don't have to assume it's in forms[0]?

Paul
Nov 19 '05 #1
3 1449
1) document.forms[0].submit('test') is an invalid syntax.. If you are looking
to send some additional value to server code, one common method is to use a
HTML Hidden Control or a TextBox Webcontrol with size 0.. In the code behind,
you could access the hidden control like Request.Form["HiddenCtrlName "]
..ToString();

2) document.SomeFo rmName.submit() ; is a valid syntax.
"PJ6" wrote:
When I have client-side script like this -

document.forms[0].submit('test')

how do I access, from server-side code, the value I put in the submit
method?

Also, is it possible to get the control's containing form name so I can
emite script like this -

document.SomeFo rmName.submit(' test')

so I don't have to assume it's in forms[0]?

Paul

Nov 19 '05 #2
PJ6
I have a control that I want to act like a button. I cannot assume that the
containing page has a hidden control. I'm looking for a way to get the
client-side OnClick event to cause the server-side control event to fire.

Paul

"Sreejith Ram" <Sr*********@di scussions.micro soft.com> wrote in message
news:3C******** *************** ***********@mic rosoft.com...
1) document.forms[0].submit('test') is an invalid syntax.. If you are
looking
to send some additional value to server code, one common method is to use
a
HTML Hidden Control or a TextBox Webcontrol with size 0.. In the code
behind,
you could access the hidden control like Request.Form["HiddenCtrlName "]
.ToString();

2) document.SomeFo rmName.submit() ; is a valid syntax.
"PJ6" wrote:
When I have client-side script like this -

document.forms[0].submit('test')

how do I access, from server-side code, the value I put in the submit
method?

Also, is it possible to get the control's containing form name so I can
emite script like this -

document.SomeFo rmName.submit(' test')

so I don't have to assume it's in forms[0]?

Paul

Nov 19 '05 #3
2) " to get the control's containing form name "

One way i could think of is, you could get the parent control recursivly
until the parentElement.t agName == 'FORM'

I m writing below code on the fly... havent tested.. but hope it gives an
idea..

<script>
notFound = false;
ParentElem = document.getEle mentById("btton Name").parentEl ement;
while(notFound == false)
{
if(ParentElem.t agName == 'FORM')
{
//Now ParentElem is the FORM containing the control
// you my exit the loop and call ParentElem.Subm it();
document.writel n(ParentElem.id );
notFound = true;
}
else
ParentElem = ParentElem.pare ntElement;
}
</script>

this should work, but you will be able to come up with a more efficient
recursive script for the same.. probably you will find a sample in
blogs/sites

1) not sure i have understood the requirement... When you say " I have a
control that I want to act like a button" , is that a webcontrol or a user
control?.. if user control, you could still have a hidden control next to the
button/image/link you are expecting the user to click..

"PJ6" wrote:
I have a control that I want to act like a button. I cannot assume that the
containing page has a hidden control. I'm looking for a way to get the
client-side OnClick event to cause the server-side control event to fire.

Paul

"Sreejith Ram" <Sr*********@di scussions.micro soft.com> wrote in message
news:3C******** *************** ***********@mic rosoft.com...
1) document.forms[0].submit('test') is an invalid syntax.. If you are
looking
to send some additional value to server code, one common method is to use
a
HTML Hidden Control or a TextBox Webcontrol with size 0.. In the code
behind,
you could access the hidden control like Request.Form["HiddenCtrlName "]
.ToString();

2) document.SomeFo rmName.submit() ; is a valid syntax.
"PJ6" wrote:
When I have client-side script like this -

document.forms[0].submit('test')

how do I access, from server-side code, the value I put in the submit
method?

Also, is it possible to get the control's containing form name so I can
emite script like this -

document.SomeFo rmName.submit(' test')

so I don't have to assume it's in forms[0]?

Paul


Nov 19 '05 #4

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

Similar topics

2
2329
by: Timo J | last post by:
Hi - Im sitting and trying to understand this OOP - and need to create a class wich can do the following.. ShowBlocks() - Displays the data wich is inside it - If empty creates a form wich sends the info back to the Object, wich show the stuff.. AddBlock( $type ) - Creates an empty blok - wich is addet to a blocks area object...( Or somethin like it ) Store() - safes the info into a file, and updates mySQL... I have figured out most...
0
1801
by: Willoughby Bridge | last post by:
Hi - Having trouble getting a multipart series of forms to move to the next form. The problem line is: <form method="post" enctype="multipart/form-data" action="Data_Form1.php"> If the "action" parameter is set to the current form (Data_Form1.php) then the data posts to the table correctly, but it does not move to the next form If the "action" parameter is set to the next form in the series then by clicking "submit" it moves to the...
1
1908
by: Chris John Jordan | last post by:
Can anyone suggest a way of getting FORM to post only its own control values? I find by default each FORM on a page POSTs the variables of all FORMs on the page, and this prevents my common ACTION script from processing each FORM individually. Thanks. -- Chris
4
4930
by: gimme_this_gimme_that | last post by:
Hi, This is sort of a : How to build a Yes/No dialog box qquestion. Or perhaps a question about getting javascript variables from a pop-up window and processing them on a submit. This is what I'd like to have happen :
9
2310
by: starbuck | last post by:
Hi, have a form, with a text input "fieldname". method POST $var = $_POST $var is then used to search in mysql select * from table where jobtype like '$var%'
2
2111
by: pm1ccc | last post by:
Hi, I have written following code and not getting back values in the same form ( i have used phpself) <?php $Fname = $_POST; $Lname = $_POST; $gender = $_POST; $food = $_POST; $quote = $_POST;
2
3565
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in uby/Rails. I started it in Perl and gave up on Perl as I went from the 'display the database information on the web page' to the 're-display the information from the database and allow the user to update the database using the web page' stage and realized...
0
2909
by: buntyindia | last post by:
Hi, I have a very strange problem with my application. I have developed it using Struts. I have a TextBox With Some fixed value in it and on Submit iam passing it to another page. <html:form action="/login"> <html:text property="userName" value="Bunty"/> <html:submit/>
1
3601
by: cumupkid | last post by:
II am trying to create a form that will allow me to upload photos to a folder in the site root directory and add the information to the mysql db at the same time. I have created two forms, one that uploads to photo to the folder in the site root diorectory. One that uploads the info to mysql database. but... When I try to upload them both ways at the same time i cant get it. I am Including code for both pages i have working. Code for...
0
8367
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8703
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7302
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2703
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.