473,794 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Server-side script with input parameter from Client-side script

Hello!

I have a client javascript that generates a string (like below). This string should then be used by server code (in this case a function called run).

<script language=javasc ript>
function getpic()
{ string s;
s = document.getEle mentById("File1 ").getAttribute ("value");
<% run(s); %>
}

I think this would be rather common, so maybe I'm missing some basics?
Regards Magnus
Nov 19 '05 #1
3 1635
Make a hidden field (via Page.RegisterHi ddenField) and have the javascript
write the value to the hidden. In the server, fetch the value via Request.Form["YourFieldI D"]

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hello!

I have a client javascript that generates a string (like below). This
string should then be used by server code (in this case a function
called run).

<script language=javasc ript>
function getpic()
{ string s;
s = document.getEle mentById("File1 ").getAttribute ("value");
<% run(s); %>
}
I think this would be rather common, so maybe I'm missing some basics?
Regards Magnus


Nov 19 '05 #2
Hello!

Now, I've tried to use a hidden field but I can't get it to work.
Below you can see my code in simplyfied versions.

What I'm trying to do is:
1. The user browses for a picture at the network from their computer using
control File1.
2. The user clickes the button Commit picture (with id CliBtn)
a. The script is running at the client to get the sharename of the file
selected
b. The script should update a picture shown (the code below just shows
the label with the path)
c. The code-behind should then save all values in a database.

The problem appear when I'm trying to set the value to the hide control, so
I am doing something wrong.
I'm not so used to web developing, so please give me some help here, with
code please.

Regards Magnus
-------------------------
Code-behind page in C#
-------------------------
void Page_Load(objec t sender, EventArgs e)
{
HtmlInputHidden hide = new HtmlInputHidden ();
hide.ID = "hide";
hide.Value = "Hidden Text";
sURL = Request.Form["hide"].ToString();
Label11.Text = sURL;
}
------------------------
..ASPX page
------------------------
<head>
<title>Untitl ed Page</title>
<script language=vbscri pt>
function getpicvb()
dim javatext
javatext = document.getEle mentById("File1 ").getAttribute ("value")
dim fso
set FSO = CreateObject("S cripting.FileSy stemObject")
dim drive
set drive =
FSO.GetDrive(FS O.GetDriveName( FSO.GetAbsolute PathName(javate xt)))
javatext = drive.ShareName
'hide.value = javatext ' this row doesn't work
alert(javatext)
end function
</script>
</head>
<body>
<input id="File1" type="file" />
<input id="CliBtn" value="Commit picture" onclick="getpic vb() " type=submit
/>
<asp:Label ID="Label11" Runat="server" Text="Label"></asp:Label>
<input type=hidden id=hide />
</body>
----------------------------------------------------------------------------
------------------------------------------------
"Brock Allen" <ba****@NOSPAMd evelop.com> wrote in message
news:44******** **************@ msnews.microsof t.com...
Make a hidden field (via Page.RegisterHi ddenField) and have the javascript
write the value to the hidden. In the server, fetch the value via Request.Form["YourFieldI D"]
-Brock
DevelopMentor
http://staff.develop.com/ballen
Hello!

I have a client javascript that generates a string (like below). This
string should then be used by server code (in this case a function
called run).

<script language=javasc ript>
function getpic()
{ string s;
s = document.getEle mentById("File1 ").getAttribute ("value");
<% run(s); %>
}
I think this would be rather common, so maybe I'm missing some basics?
Regards Magnus


Nov 19 '05 #3
This question has a new node with Subject "Set a value to a hidden field in
a web page"
/Magnus
"Brock Allen" <ba****@NOSPAMd evelop.com> wrote in message
news:44******** **************@ msnews.microsof t.com...
Make a hidden field (via Page.RegisterHi ddenField) and have the javascript
write the value to the hidden. In the server, fetch the value via Request.Form["YourFieldI D"]
-Brock
DevelopMentor
http://staff.develop.com/ballen
Hello!

I have a client javascript that generates a string (like below). This
string should then be used by server code (in this case a function
called run).

<script language=javasc ript>
function getpic()
{ string s;
s = document.getEle mentById("File1 ").getAttribute ("value");
<% run(s); %>
}
I think this would be rather common, so maybe I'm missing some basics?
Regards Magnus


Nov 19 '05 #4

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

Similar topics

2
15230
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000 Personal disk from the SQL Server 2000 Enterprise kit as this is reported here on the MSDN web site to be the version that is supported on Windows XP. In fact so many of you kind people confess to having succeeded in doing it. I have tried...
0
2044
by: Philip Trim | last post by:
General Brief: 3 SQL Servers as MS SQL Server 2000 Standard Edition with Service Pack 3 All using FTP for snapshots All Servers are both Publishers and Distributors. Server A has the correct data needed to be replicated to Server B and C. Server B and C and have blank data. Server B and C are blank databases ready for replication. Server A publishers to Server B and Server C
5
2744
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create a server group. I right click on the "SQL Server Group" and make a name of "TEST" and put in the subgroup of "SQL Server Group". Next, I try to register the "TEST" server group. I right click on the "TEST" server group and New Server Group...
2
2133
by: Jay Chan | last post by:
We have just installed a SQL Server 2000 (SP 3A) onto a computer that has Windows-2003 Server on it. Now, we cannot get access to that database server from other computers. Seem like this may be an issue with Active Directory. Our network consists of Windows-2000 Servers (SP 4) and Windows-2000 workstations and Windows-XP workstations. We also have SQL Server 2000 (SP2) in three Windows-2000 servers. All work fine. Recently, we get a...
22
3306
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to load DLL (aspnet_isapi.dll)." Of course the dll is able to be found, it's still in the framework directory and for grins I even put it in my service's local directory. This is apparantly server 2003 not allowing asp.net to be run if IIS was not...
4
7304
by: coosa | last post by:
Hi, I was installing SQL Server on my machine and during installation my PC freezed. It happens frequently on my machine. So i tried after restarting to install it again and since then i always get the same error message: "An error occurred while creating one or more registry entries. Please see C:\WINDOWS\sqlstp.log for details. The problem could be caused by a low registry quota condition" I have tried to clean the registry and i...
1
6642
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005 Express Edition x86: Component Microsoft SQL Server 2005 Express Edition x86 returned an unexpected value. ***EndOfSession***? Microsoft SQL Server 2005 Express Edition x86: Component Microsoft SQL Server 2005 Express Edition x86 returned an...
14
7043
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that sql server resides on is not reachable. The error is different depending on the connection string that I use. If I use the following connection string: "server=192.1.1.1; Initial Catalog=master; uid=The_User; password=The_Password; Connect...
10
16219
by: sara | last post by:
Hi All, I was able to connect to MS SQL Server 2005 on my computer but after a while I can not. When I want to connect to it using MS SQL Server Management Studio I got this error: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider,...
1
3227
by: manish deshpande | last post by:
Hi, When i'm installing MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm by the following command: rpm -i MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm the following error is being shown: warning: MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5 file /etc/my.cnf from install of MySQL-server-standard-5.0.24a-0.rhel3 conflicts with file from package mysql-3.23.58-1 file...
0
9518
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10161
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
9035
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
7538
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
6777
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4112
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
2
3720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2919
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.