IIS ASP - javascript to ASP - passing variable values

This is Interesting: Free IT Magazines  
Home > Archive > IIS ASP > April 2006 > javascript to ASP - passing variable values





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author javascript to ASP - passing variable values
u0107

2006-04-27, 7:52 am


Hello all,

I have an ASP generated form to maintain a back end Access Database.
Some tables have Memo Type fields.

On account of the limitations of the length of the URL String, I am
unable to include user entered values of length greater than 2048 bytes
in such memo fields in the URL.

The technique I use:

1) Through ASP generate the Form in HTML.
2) Accept form element values. (two elements are Memo fields)
3) When Submit button is clicked, I pass control to a javascript
function which extracts values from each of the form fields and
assembles them into a URL String of the type
"http://www.mysite.com/update_table_1.asp??field1name=some_field_name&field1value=some_value
somefield2name=some_other_field_name& some_other_field_value=dsakfsakfdjdsasaj
dfklsajdflkdsjaaksj"
4) Now consider that the field "some_other_field_name" is a memo field
and the value is really some 3K bytes long. (Of course I used
URLEncode to encode the URL.)

My question is how do I pass the value of this memo field to the
update_table_1.asp code

I am veering to using XHTML for the purpose - there are some solutions
which are posted on other fora but right now they appear to complicated
for me.

Any simpler solution will be most welcome.

Thanks in advance.

Uttam



--
u0107
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Mike Brind

2006-04-27, 7:52 am


u0107 wrote:
> Hello all,
>
> I have an ASP generated form to maintain a back end Access Database.
> Some tables have Memo Type fields.
>
> On account of the limitations of the length of the URL String, I am
> unable to include user entered values of length greater than 2048 bytes
> in such memo fields in the URL.
>
> The technique I use:
>
> 1) Through ASP generate the Form in HTML.
> 2) Accept form element values. (two elements are Memo fields)
> 3) When Submit button is clicked, I pass control to a javascript
> function which extracts values from each of the form fields and
> assembles them into a URL String of the type
> "http://www.mysite.com/update_table_1.asp??field1name=some_field_name&field1value=some_value
> somefield2name=some_other_field_name& some_other_field_value=dsakfsakfdjdsasaj
dfklsajdflkdsjaaksj"
> 4) Now consider that the field "some_other_field_name" is a memo field
> and the value is really some 3K bytes long. (Of course I used
> URLEncode to encode the URL.)
>
> My question is how do I pass the value of this memo field to the
> update_table_1.asp code
>
> I am veering to using XHTML for the purpose - there are some solutions
> which are posted on other fora but right now they appear to complicated
> for me.
>
> Any simpler solution will be most welcome.
>
> Thanks in advance.
>
> Uttam
>


Why aren't you using the POST method for the form?

--
Mike Brind

Aaron Bertrand [SQL Server MVP]

2006-04-27, 7:52 am

> 3) When Submit button is clicked, I pass control to a javascript
> function which extracts values from each of the form fields and
> assembles them into a URL String of the type
> "http://www.mysite.com/update_table_1.asp??field1name=some_field_name&field1value=some_value
> somefield2name=some_other_field_name& some_other_field_value=dsakfsakfdjdsasaj
dfklsajdflkdsjaaksj"
> 4) Now consider that the field "some_other_field_name" is a memo field
> and the value is really some 3K bytes long. (Of course I used
> URLEncode to encode the URL.)
>
> My question is how do I pass the value of this memo field to the
> update_table_1.asp code


I have to agree with Mike. Why not just post the form to
update_table_1.asp?


SpiderSwamy

2006-04-27, 7:52 am

Hi, I too think so that u can use the POST method, any way its u r
wish.

I have used a field called Expertise(Memo Datatype in MS Access) , I
have used GET method so this field value will be there in URL, I will
retrive that value add it to DB.
Code:

strExpertise = Request.querystring("Expertise") ' To get value from
URL(that is query string)

dim strCon,RSInsert,RSSeqID
set strCon=server.CreateObject("ADODB.Connection")
set RSInsert=server.CreateObject("ADODB.Recordset")
set RSSeqID=server.CreateObject("ADODB.Recordset")

Expertise=Request("Expertise")

dsnStrin="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
server.mappath("repository.mdb") & ";"
strCon.open dsnStrin

RSInsert.Open "Select OHR_ID from registration", strCon
RSInsert("Expertise")=Expertise

I wish that this code may work for u....

Bye
SpiderSwamy

SpiderSwamy

2006-04-27, 7:52 am

Hi, I too think so that u can use the POST method, any way its u r
wish.

I have used a field called Expertise(Memo Datatype in MS Access) , I
have used GET method so this field value will be there in URL, I will
retrive that value add it to DB.
Code:

strExpertise = Request.querystring("Expertise") ' To get value from
URL(that is query string)

dim strCon,RSInsert,RSSeqID
set strCon=server.CreateObject("ADODB.Connection")
set RSInsert=server.CreateObject("ADODB.Recordset")
set RSSeqID=server.CreateObject("ADODB.Recordset")

Expertise=Request("Expertise")

dsnStrin="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
server.mappath("repository.mdb") & ";"
strCon.open dsnStrin

RSInsert.Open "Select OHR_ID from registration", strCon
RSInsert("Expertise")=Expertise

I wish that this code may work for u....

Bye
SpiderSwamy

SpiderSwamy

2006-04-27, 7:52 am

don't forget to close the DB

RSInsert.Update
RSInsert.Close

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com