473,473 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Create 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.SomeFormName.submit('test')

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

Paul
Nov 19 '05 #1
3 1429
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.SomeFormName.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.SomeFormName.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*********@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.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.SomeFormName.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.SomeFormName.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.tagName == 'FORM'

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

<script>
notFound = false;
ParentElem = document.getElementById("bttonName").parentElement ;
while(notFound == false)
{
if(ParentElem.tagName == 'FORM')
{
//Now ParentElem is the FORM containing the control
// you my exit the loop and call ParentElem.Submit();
document.writeln(ParentElem.id);
notFound = true;
}
else
ParentElem = ParentElem.parentElement;
}
</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*********@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.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.SomeFormName.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.SomeFormName.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
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...
0
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...
1
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...
4
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...
9
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
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 =...
2
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...
0
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...
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.