Hi. I have this problem that I think should be easy but have been struggling
with this for days.
I have a list based on a recordset from a database. This list consists of
records meeting a certain criteria and at the bottom of this list i have a
button that inserts all these records to a´nother table in the database. So
long everything's ok.
BUT, at the top of this list I have a textarea that the user can write down
some text to be put into every record in the table also. I can't loop this
textarea, then I would have to fill out them all anyway.
I think that some variable witch fetched the text from an onload popup
window by request.form or javascript prompt would do the trick but I'm not
sure if it's possible or even how to do this. -And, I would like to have the
textarea at the top of the page instead of some silly popup thing.
How could I achieve this?
Re: Textarea outside of loop
am 19.12.2006 12:54:39 von Kevin Hayes
need to see your code
"Jen" wrote in message
news:%23c5OiD2IHHA.4000@TK2MSFTNGP06.phx.gbl...
> Hi. I have this problem that I think should be easy but have been
> struggling with this for days.
> I have a list based on a recordset from a database. This list consists of
> records meeting a certain criteria and at the bottom of this list i have a
> button that inserts all these records to a´nother table in the database.
> So long everything's ok.
> BUT, at the top of this list I have a textarea that the user can write
> down some text to be put into every record in the table also. I can't loop
> this textarea, then I would have to fill out them all anyway.
> I think that some variable witch fetched the text from an onload popup
> window by request.form or javascript prompt would do the trick but I'm not
> sure if it's possible or even how to do this. -And, I would like to have
> the textarea at the top of the page instead of some silly popup thing.
>
> How could I achieve this?
>
>
Re: Textarea outside of loop
am 19.12.2006 13:18:03 von reb01501
Jen wrote:
> Hi. I have this problem that I think should be easy but have been
> struggling with this for days.
> I have a list based on a recordset from a database. This list
> consists of records meeting a certain criteria and at the bottom of
> this list i have a button that inserts all these records to a´nother
> table in the database. So long everything's ok.
> BUT, at the top of this list I have a textarea that the user can
> write down some text to be put into every record in the table also. I
> can't loop this textarea, then I would have to fill out them all
> anyway. I think that some variable witch fetched the text from an onload
> popup
> window by request.form or javascript prompt would do the trick but
> I'm not sure if it's possible or even how to do this. -And, I would
> like to have the textarea at the top of the page instead of some
> silly popup thing.
> How could I achieve this?
This sounds "wrong-headed" for two reasons:
1. You are storing data (rows) in two separate places in the database.
Unless this is some sort of archiving scheme, this practice will typically
lead to maintenance nightmares.
2. You are storing the same data into multiple rows in a table. I cannot
fathom a possible reason for doing this. Could you explain please?
Having said that, I don't understand the problem you are having. "Looping"
through a textarea should not have even entered your mind if I am
understanding your requirements correctly: simply assign the text in the
textarea to a variable and use that variable in your insert statements. Why
would you even be thinking about a popup window?
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Re: Textarea outside of loop
am 19.12.2006 14:44:10 von Kevin Hayes
"Bob Barrows [MVP]" wrote in message
news:uD%23C8e2IHHA.4384@TK2MSFTNGP03.phx.gbl...
> Jen wrote:
>> Hi. I have this problem that I think should be easy but have been
>> struggling with this for days.
>> I have a list based on a recordset from a database. This list
>> consists of records meeting a certain criteria and at the bottom of
>> this list i have a button that inserts all these records to a´nother
>> table in the database. So long everything's ok.
>> BUT, at the top of this list I have a textarea that the user can
>> write down some text to be put into every record in the table also. I
>> can't loop this textarea, then I would have to fill out them all
>> anyway. I think that some variable witch fetched the text from an onload
>> popup
>> window by request.form or javascript prompt would do the trick but
>> I'm not sure if it's possible or even how to do this. -And, I would
>> like to have the textarea at the top of the page instead of some
>> silly popup thing.
>> How could I achieve this?
>
> This sounds "wrong-headed" for two reasons:
>
> 1. You are storing data (rows) in two separate places in the database.
> Unless this is some sort of archiving scheme, this practice will typically
> lead to maintenance nightmares.
> 2. You are storing the same data into multiple rows in a table. I cannot
> fathom a possible reason for doing this. Could you explain please?
>
> Having said that, I don't understand the problem you are having. "Looping"
> through a textarea should not have even entered your mind if I am
> understanding your requirements correctly: simply assign the text in the
> textarea to a variable and use that variable in your insert statements.
> Why would you even be thinking about a popup window?
>
>
my thoughts also,
Need to see code
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
Re: Textarea outside of loop
am 19.12.2006 15:57:48 von Jen
> 1. You are storing data (rows) in two separate places in the database.
> Unless this is some sort of archiving scheme, this practice will typically
> lead to maintenance nightmares.
> 2. You are storing the same data into multiple rows in a table. I cannot
> fathom a possible reason for doing this. Could you explain please?
>
> Having said that, I don't understand the problem you are having. "Looping"
> through a textarea should not have even entered your mind if I am
> understanding your requirements correctly: simply assign the text in the
> textarea to a variable and use that variable in your insert statements.
> Why would you even be thinking about a popup window?
>
> 1. This won't lead to any maintenance nightmares(well, one can hope, I'm
> not that good at this as you can see ;), these tables are linked in a
> relationship.
2. I am not storing any same data into multiple rows in a table. Basically,
this is a simple monthly billing app. I have one table holding the tenant's
data (name and addresses, monthly rent's & other monthly payments, unique
text to print on the bill for the actual tenant etc. etc.), one (linked)
table holding the landlord's 80-90 apartemnt's and one (unlinked) table with
the landlord's data (bank-accounts etc.)
Then I have this linked table consisting of the bills.
The landlord wants to open (log on to) this app once a month online and
simply write something that is unique for the actual month (the name of the
year & month, some christmas greetings.. for example, and here's the
textarea causing me the headache), klick on print at the bottom of the list
and every bill is printed out at the same time as these are written into the
bills table. And presto, the landlord is done for the month with wery little
effort. The bills are later wiewable all by month or by apartment or by
tenant in a timeframe that is choosen.
How would I assign a textarea to a variable on the same page? I'm reading
this can't be done (http://www.dmxzone.com/forum/topic.asp?topic_id=15746),
thus my thoughts on some popup solution.
Please bear with me, I'm new at this stuff, and on top of that my english
isn't that good my mothertung being swedish
:[
Jen.
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
Re: Textarea outside of loop
am 19.12.2006 16:35:57 von Kevin Hayes
"Jen" wrote in message
news:OX%23ZP43IHHA.3552@TK2MSFTNGP03.phx.gbl...
>> 1. You are storing data (rows) in two separate places in the database.
>> Unless this is some sort of archiving scheme, this practice will
>> typically lead to maintenance nightmares.
>> 2. You are storing the same data into multiple rows in a table. I cannot
>> fathom a possible reason for doing this. Could you explain please?
>>
>> Having said that, I don't understand the problem you are having.
>> "Looping" through a textarea should not have even entered your mind if I
>> am understanding your requirements correctly: simply assign the text in
>> the textarea to a variable and use that variable in your insert
>> statements. Why would you even be thinking about a popup window?
>>
>> 1. This won't lead to any maintenance nightmares(well, one can hope, I'm
>> not that good at this as you can see ;), these tables are linked in a
>> relationship.
>
> 2. I am not storing any same data into multiple rows in a table.
> Basically, this is a simple monthly billing app. I have one table holding
> the tenant's data (name and addresses, monthly rent's & other monthly
> payments, unique text to print on the bill for the actual tenant etc.
> etc.), one (linked) table holding the landlord's 80-90 apartemnt's and one
> (unlinked) table with the landlord's data (bank-accounts etc.)
> Then I have this linked table consisting of the bills.
> The landlord wants to open (log on to) this app once a month online and
> simply write something that is unique for the actual month (the name of
> the year & month, some christmas greetings.. for example, and here's the
> textarea causing me the headache), klick on print at the bottom of the
> list and every bill is printed out at the same time as these are written
> into the bills table. And presto, the landlord is done for the month with
> wery little effort. The bills are later wiewable all by month or by
> apartment or by tenant in a timeframe that is choosen.
> How would I assign a textarea to a variable on the same page? I'm reading
> this can't be done
> (http://www.dmxzone.com/forum/topic.asp?topic_id=15746), thus my thoughts
> on some popup solution.
why cant it be done.
This seems like a simple job
We need to see your code
>
> Please bear with me, I'm new at this stuff, and on top of that my english
> isn't that good my mothertung being swedish
> :[
>
> Jen.
>
>>
>> --
>> Microsoft MVP - ASP/ASP.NET
>> Please reply to the newsgroup. This email account is my spam trap so I
>> don't check it very often. If you must reply off-line, then remove the
>> "NO SPAM"
>>
>
>
Re: Textarea outside of loop
am 19.12.2006 17:02:08 von reb01501
Jen wrote:
>> 1. You are storing data (rows) in two separate places in the
>> database. Unless this is some sort of archiving scheme, this
>> practice will typically lead to maintenance nightmares.
>> 2. You are storing the same data into multiple rows in a table. I
>> cannot fathom a possible reason for doing this. Could you explain
>> please?
>>
>> Having said that, I don't understand the problem you are having.
>> "Looping" through a textarea should not have even entered your mind
>> if I am understanding your requirements correctly: simply assign the
>> text in the textarea to a variable and use that variable in your
>> insert statements. Why would you even be thinking about a popup
>> window?
>>
>> 1. This won't lead to any maintenance nightmares(well, one can hope,
>> I'm not that good at this as you can see ;), these tables are linked
>> in a relationship.
>
> 2. I am not storing any same data into multiple rows in a table.
That's how I interpreted this:
" ... some text to be put into every record in the table also."
> Basically, this is a simple monthly billing app. I have one table
> holding the tenant's data (name and addresses, monthly rent's & other
> monthly payments, unique text to print on the bill for the actual
> tenant etc. etc.), one (linked) table holding the landlord's 80-90
> apartemnt's and one (unlinked) table with the landlord's data
> (bank-accounts etc.)
> Then I have this linked table consisting of the bills.
> The landlord wants to open (log on to) this app once a month online
> and simply write something that is unique for the actual month (the
> name of the year & month, some christmas greetings.. for example, and
> here's the textarea causing me the headache), klick on print at the
> bottom of the list and every bill is printed out at the same time as
> these are written into the bills table. And presto, the landlord is
> done for the month with wery little effort. The bills are later
> wiewable all by month or by apartment or by tenant in a timeframe
> that is choosen.
So you should create a table to contain the monthly message: one record
per month. use a join to link the monthly message to the bills paid for
that month
> How would I assign a textarea to a variable on the same page? I'm
> reading this can't be done
> (http://www.dmxzone.com/forum/topic.asp?topic_id=15746),
What do you mean? There are two examples of doing it on that page. I
suspect Brian was not expressing himself very well.
> thus my
> thoughts on some popup solution.
I still don't understand why that would be relevant.
>
> Please bear with me, I'm new at this stuff, and on top of that my
> english isn't that good my mothertung being swedish
Your english is better than my swedish :-)
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Re: Textarea outside of loop
am 19.12.2006 17:29:02 von Jen
So you should create a table to contain the monthly message: one record
> per month. use a join to link the monthly message to the bills paid for
> that month
>
>> How would I assign a textarea to a variable on the same page? I'm
>> reading this can't be done
>> (http://www.dmxzone.com/forum/topic.asp?topic_id=15746),
>
> What do you mean? There are two examples of doing it on that page. I
> suspect Brian was not expressing himself very well.
>
>> thus my
>> thoughts on some popup solution.
>
> I still don't understand why that would be relevant.
>
>>
>> Please bear with me, I'm new at this stuff, and on top of that my
>> english isn't that good my mothertung being swedish
>
> Your english is better than my swedish :-)
> --
If a textarea is on the same page that the sql insert code, how would one
get the text from the textarea into a variable without "refreshing" the
page? It is static on the screen while writing in text in the textbox, it
wont get into a variable by simple writin the text(?) Or would one use some
kind og afterupdate "behaviour" on the textarea for putting the text into a
variable on the page and thus getting the text into each record? This is why
I talked about some popup window where I could get the text from a textarea
in this popup window into an variable with request.form.
Anyways, here's the code (form) if that can help you guys help me. I really
do appretiate you taking the time to try to help out us beginners.
class="ewTable" id="form_fakturera">
Skriv in text som syns på varje faktura denna månad:
<% ins_rs_fakturera = ins_rs_fakturera+1 %>
Namn
Hyresbostad
Näradress
Telefon
Fakturatext
Månadshyra
Moms
<%
While ((Repeat1__numRows <> 0) AND (NOT rs_fakturera.EOF))
%>
Jen wrote:
> If a textarea is on the same page that the sql insert code,
I don't see any sql insert code in your extract. All I see is the code
for displaying the data. I searched for "Insert", "AddNew" and "Update".
Are you sure the insert isn't happening on the page to which you submit
this form?
> how would
> one get the text from the textarea into a variable without
> "refreshing" the page? It is static on the screen while writing in
> text in the textbox, it wont get into a variable by simple writin the
> text(?) Or would one use some kind og afterupdate "behaviour" on the
> textarea for putting the text into a variable on the page and thus
> getting the text into each record?
Now we are getting into client-side code which is out of scope for this
group: ASP is server-side code. When you start talking about
afterupdate, or any other event that takes place on the client, then you
are no longer in the ASP "world". Further questions about this should go
to a client-side scripting group such as
microsoft.public.scripting.jscript.
Here is a simple example of what you seem to want (note: you can save
this in a .htm page and it will work, which reinforces the point that
this is no longer about asp):
onchange="handleChange(this);">
Run the page, type in some text and press tab.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Re: Textarea outside of loop
am 19.12.2006 18:37:43 von Jen
> I don't see any sql insert code in your extract. All I see is the code
> for displaying the data. I searched for "Insert", "AddNew" and "Update".
> Are you sure the insert isn't happening on the page to which you submit
> this form?
>
>> how would
>> one get the text from the textarea into a variable without
>> "refreshing" the page? It is static on the screen while writing in
>> text in the textbox, it wont get into a variable by simple writin the
>> text(?) Or would one use some kind og afterupdate "behaviour" on the
>> textarea for putting the text into a variable on the page and thus
>> getting the text into each record?
>
> Now we are getting into client-side code which is out of scope for this
> group: ASP is server-side code. When you start talking about
> afterupdate, or any other event that takes place on the client, then you
> are no longer in the ASP "world". Further questions about this should go
> to a client-side scripting group such as
> microsoft.public.scripting.jscript.
>
> Here is a simple example of what you seem to want (note: you can save
> this in a .htm page and it will work, which reinforces the point that
> this is no longer about asp):
>
>
>
>
>
>
>
> onchange="handleChange(this);">
>
>
>
>
> Run the page, type in some text and press tab.
>
I'm not going for some client side scripts, I was just thinking out loud how
it could be possible inserting the text from a textarea into a variable,
textarea being on the same page as the variable. I probably understood you
wrong as I thought you made it clear that there couldn't be any problem
getting the text from a textarea into a variable from one and same page,
despite the posts in the dmxzone njewsgroup.
I don't think your javascript example would work anyway in this case.
Nothing serverside (variable) is refreshed.
Here's the code including the insert code, sorry, I left it out by mistake.
And here's a screendump of the page with the list and the textarea (the
values going into the table are in hiddenfields
http://www.comtech.fi/filer/example.gif)
Jen.
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" &
Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
Dim rs_fakturera
Dim rs_fakturera_numRows
Set rs_fakturera = Server.CreateObject("ADODB.Recordset")
rs_fakturera.ActiveConnection = MM_conn_heinonen_STRING
rs_fakturera.Source = "SELECT hyresgast.*, bostad.* FROM bostad INNER JOIN
hyresgast ON bostad.bostads_id = hyresgast.Hyresbostad WHERE
skall_faktureras = true ORDER BY Efternamn"
rs_fakturera.CursorType = 2
rs_fakturera.CursorLocation = 2
rs_fakturera.LockType = 1
rs_fakturera.Open()
rs_fakturera_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rs_fakturera_numRows = rs_fakturera_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats
variables
Dim rs_fakturera_total
Dim rs_fakturera_first
Dim rs_fakturera_last
' set the record count
rs_fakturera_total = rs_fakturera.RecordCount
' set the number of rows displayed on this page
If (rs_fakturera_numRows < 0) Then
rs_fakturera_numRows = rs_fakturera_total
Elseif (rs_fakturera_numRows = 0) Then
rs_fakturera_numRows = 1
End If
' set the first and last displayed record
rs_fakturera_first = 1
rs_fakturera_last = rs_fakturera_first + rs_fakturera_numRows - 1
' if we have the correct record count, check the other stats
If (rs_fakturera_total <> -1) Then
If (rs_fakturera_first > rs_fakturera_total) Then
rs_fakturera_first = rs_fakturera_total
End If
If (rs_fakturera_last > rs_fakturera_total) Then
rs_fakturera_last = rs_fakturera_total
End If
If (rs_fakturera_numRows > rs_fakturera_total) Then
rs_fakturera_numRows = rs_fakturera_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count
them
If (rs_fakturera_total = -1) Then
' count the total records by iterating through the recordset
rs_fakturera_total=0
While (Not rs_fakturera.EOF)
rs_fakturera_total = rs_fakturera_total + 1
rs_fakturera.MoveNext
Wend
' reset the cursor to the beginning
If (rs_fakturera.CursorType > 0) Then
rs_fakturera.MoveFirst
Else
rs_fakturera.Requery
End If
' set the number of rows displayed on this page
If (rs_fakturera_numRows < 0 Or rs_fakturera_numRows > rs_fakturera_total)
Then
rs_fakturera_numRows = rs_fakturera_total
End If
' set the first and last displayed record
rs_fakturera_first = 1
rs_fakturera_last = rs_fakturera_first + rs_fakturera_numRows - 1
If (rs_fakturera_first > rs_fakturera_total) Then
rs_fakturera_first = rs_fakturera_total
End If
If (rs_fakturera_last > rs_fakturera_total) Then
rs_fakturera_last = rs_fakturera_total
End If
End If
%>
<%
' *** FX Insert Multiple Records SP in form_fakturera
If (rs_fakturera_first <> "") Then ins_rs_fakturera = rs_fakturera_first-1
Else ins_rs_fakturera = 0 End If ' counter
If (cStr(Request.Form("Submit")) <> "") Then
FX_sqlerror = ""
FX_insredir = "fakturalist.asp"
FX_fields =
Array("txt_egen_fakturatext","hiddenField_daum","hiddenField _manad_ar","hiddenField_efternamn","hiddenField_fornamn","hi ddenField_kund_id","hiddenField_hyresbostad","hiddenField_bo stadsnamn","hiddenField_naradress","hiddenField_telefon","hi ddenField_fakturatext","hiddenField_manadshyra","hiddenField _finsk","hiddenField_postnr","hiddenField_postadress","hidde nField_betalningstid","hiddenField_moms","hiddenField_betald ")
FX_altv = false
tmp = "ADODB.Command"
Set insert_Multi = Server.CreateObject(tmp)
insert_Multi.ActiveConnection = MM_conn_heinonen_STRING
For N = ins_rs_fakturera+1 To rs_fakturera_total
found = false
For i = 0 To UBound(FX_fields)
If (cStr(Request.Form(FX_fields(i)&N)) <> "" Or FX_altv = true) Then
found = true
Exit For
End If
Next
If (found = true) Then
If (Request.Form("txt_egen_fakturatext"&N) <> "") Then s1 =
Replace(Request.Form("txt_egen_fakturatext"&N),"'","''") Else s1 = "" End If
If (Request.Form("hiddenField_daum"&N) <> "") Then s2 =
Replace(Request.Form("hiddenField_daum"&N),"'","''") Else s2 = "" End If
If (Request.Form("hiddenField_manad_ar"&N) <> "") Then s3 =
Replace(Request.Form("hiddenField_manad_ar"&N),"'","''") Else s3 = "" End If
If (Request.Form("hiddenField_efternamn"&N) <> "") Then s4 =
Replace(Request.Form("hiddenField_efternamn"&N),"'","''") Else s4 = "" End
If
If (Request.Form("hiddenField_fornamn"&N) <> "") Then s5 =
Replace(Request.Form("hiddenField_fornamn"&N),"'","''") Else s5 = "" End If
If (Request.Form("hiddenField_kund_id"&N) <> "") Then s6 =
Replace(Request.Form("hiddenField_kund_id"&N),"'","''") Else s6 = "0" End If
If (Request.Form("hiddenField_hyresbostad"&N) <> "") Then s7 =
Replace(Request.Form("hiddenField_hyresbostad"&N),"'","''") Else s7 = "0"
End If
If (Request.Form("hiddenField_bostadsnamn"&N) <> "") Then s8 =
Replace(Request.Form("hiddenField_bostadsnamn"&N),"'","''") Else s8 = "" End
If
If (Request.Form("hiddenField_naradress"&N) <> "") Then s9 =
Replace(Request.Form("hiddenField_naradress"&N),"'","''") Else s9 = "" End
If
If (Request.Form("hiddenField_telefon"&N) <> "") Then s10 =
Replace(Request.Form("hiddenField_telefon"&N),"'","''") Else s10 = "" End If
If (Request.Form("hiddenField_fakturatext"&N) <> "") Then s11 =
Replace(Request.Form("hiddenField_fakturatext"&N),"'","''") Else s11 = ""
End If
If (Request.Form("hiddenField_manadshyra"&N) <> "") Then s12 =
Replace(Request.Form("hiddenField_manadshyra"&N),"'","''") Else s12 = "" End
If
If (Request.Form("hiddenField_finsk"&N) <> "") Then s13 =
Replace(Request.Form("hiddenField_finsk"&N),"'","''") Else s13 = "" End If
If (Request.Form("hiddenField_postnr"&N) <> "") Then s14 =
Replace(Request.Form("hiddenField_postnr"&N),"'","''") Else s14 = "" End If
If (Request.Form("hiddenField_postadress"&N) <> "") Then s15 =
Replace(Request.Form("hiddenField_postadress"&N),"'","''") Else s15 = "" End
If
If (Request.Form("hiddenField_betalningstid"&N) <> "") Then s16 =
Replace(Request.Form("hiddenField_betalningstid"&N),"'","''" ) Else s16 = ""
End If
If (Request.Form("hiddenField_moms"&N) <> "") Then s17 =
Replace(Request.Form("hiddenField_moms"&N),"'","''") Else s17 = "0" End If
If (Request.Form("hiddenField_betald"&N) <> "") Then s18 =
Replace(Request.Form("hiddenField_betald"&N),"'","''") Else s18 = "0" End If
On Error Resume Next
insert_Multi.CommandText = "INSERT INTO faktura (egen_text, datum,
manad_ar, efternamn, fornamn, Kund_ID, Hyresobjekt_id, hyresbostad,
naradress, telefon, text_pa_faktura, manadshyra, finsk, postnr, postadress,
betalningstid_dagar, moms, betald) VALUES ('"+s1+"', '"+s2+"', '"+s3+"',
'"+s4+"', '"+s5+"', "+s6+", "+s7+", '"+s8+"', '"+s9+"', '"+s10+"',
'"+s11+"', '"+s12+"', '"+s13+"', '"+s14+"', '"+s15+"', '"+s16+"', "+s17+",
"+s18+")"
insert_Multi.Execute
If (Err.Description <> "") Then
FX_sqlerror = FX_sqlerror & "Row " & N & ": " & Err.Description &
"
"
End If
End If
Next
insert_Multi.ActiveConnection.Close
thispath = cStr(Request.ServerVariables("SCRIPT_NAME"))
If (FX_insredir = "") Then FX_insredir = Mid(thispath, InstrRev(thispath,
"/")+1) End If
If (Request.QueryString <> "") Then
ch = "&"
If (InStr(FX_insredir,"?") = 0) Then ch = "?" End If
FX_insredir = FX_insredir & ch & Request.QueryString
End If
If (FX_sqlerror <> "") Then
Response.Write(""&FX_sqlerror&"")
Else Response.Redirect(FX_insredir) End If
End If
%>
<%
If Not IsLoggedIn Then Response.Redirect "login.asp"
%>
class="ewTable" id="form_fakturera">
Skriv in text som syns på varje faktura denna månad:
<% ins_rs_fakturera = ins_rs_fakturera+1 %>
Namn
Hyresbostad
Näradress
Telefon
Fakturatext
Månadshyra
Moms
<%
While ((Repeat1__numRows <> 0) AND (NOT rs_fakturera.EOF))
%>
<%
rs_fakturera.Close()
Set rs_fakturera = Nothing
%>
Re: Textarea outside of loop
am 19.12.2006 19:25:04 von reb01501
Jen wrote:
> I'm not going for some client side scripts, I was just thinking out
> loud how it could be possible inserting the text from a textarea into
> a variable, textarea being on the same page as the variable. I
> probably understood you wrong as I thought you made it clear that
> there couldn't be any problem getting the text from a textarea into a
> variable from one and same page, despite the posts in the dmxzone
> njewsgroup.
> I don't think your javascript example would work anyway in this case.
> Nothing serverside (variable) is refreshed.
Now we have a fundamental problem. Nothing server-side can be refreshed
without a form submission. This is pretty basic. In order for something
to happen on the server, something has to be sent to the server.
Using an xmlhttp object, data can be submitted to the server without
leaving/refreshing your page. This again is client-side code so I'm
going to ask you to google the subject and post any further question you
have to a client-side group.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Re: Textarea outside of loop
am 20.12.2006 07:31:29 von Jen
> Now we have a fundamental problem. Nothing server-side can be refreshed
> without a form submission. This is pretty basic. In order for something
> to happen on the server, something has to be sent to the server.
>
> Using an xmlhttp object, data can be submitted to the server without
> leaving/refreshing your page. This again is client-side code so I'm
> going to ask you to google the subject and post any further question you
> have to a client-side group.
>
Please, I do understand this server-side/ client-side refresh problem, thats
the core of my problem, no need to stress this out forever and ask me to
leave the group only if you don't have the answer to my initial basic
question. The refresh-thing wont work.
You were basically wrong in your earlier statements?:
"simply assign the text in the
textarea to a variable and use that variable in your insert statements. Why
would you even be thinking about a popup window?"
> How would I assign a textarea to a variable on the same page? I'm
> reading this can't be done
> (http://www.dmxzone.com/forum/topic.asp?topic_id=15746),
"What do you mean? There are two examples of doing it on that page. I
suspect Brian was not expressing himself very well.
I still don't understand why that [popup] would be relevant."
Thanks for taking the time to answering though and happy holidays to you.
Anybody else that could answer this initial question of mine:?
I have a list based on a recordset from a database. This list consists of
records meeting a certain criteria and at the bottom of this list i have a
button that inserts all these records to a´nother table in the database. So
long everything's ok.
BUT, at the top of this list I have a textarea that the user can write down
some text to be put into every record in the table also. I can't loop this
textarea, then I would have to fill out them all anyway.
A screenshot can be found here: http://www.comtech.fi/filer/example.gif
I think that some variable witch fetched the text from an onload popup
window by request.form or javascript prompt would do the trick but I'm not
sure if it's possible or even how to do this. -And, I would like to have the
textarea at the top of the page instead of some silly popup thing.
Jen.
Re: Textarea outside of loop
am 20.12.2006 09:14:06 von Jen
Got it working using a popup window. Thanks to all and a merry christmas.
Jen.
Re: Textarea outside of loop
am 20.12.2006 11:01:25 von Kevin Hayes
There was no need to use a popup window. Popups are messy way to gain input
Can we see the code of your popup window?
Is this code produced by some sort of editor?
"Jen" wrote in message
news:%23Rm4U7AJHHA.4068@TK2MSFTNGP03.phx.gbl...
> Got it working using a popup window. Thanks to all and a merry christmas.
>
> Jen.
>
Re: Textarea outside of loop
am 20.12.2006 12:21:11 von Jen
Slim, instead of keeping asking a lot, giving everyone an image of that you
are so good at this and never telling anything of value anyway, you got the
code you asked for before, why don't you show how to do this without the
popup window? :)
Jen.
"Slim" wrote in message
news:%2346$Q3BJHHA.2312@TK2MSFTNGP02.phx.gbl...
> There was no need to use a popup window. Popups are messy way to gain
> input
>
> Can we see the code of your popup window?
>
> Is this code produced by some sort of editor?
>
>
> "Jen" wrote in message
> news:%23Rm4U7AJHHA.4068@TK2MSFTNGP03.phx.gbl...
>> Got it working using a popup window. Thanks to all and a merry christmas.
>>
>> Jen.
>>
>
>
Re: Textarea outside of loop
am 20.12.2006 13:44:37 von Kevin Hayes
"Jen" wrote in message
news:eB$f3jCJHHA.1044@TK2MSFTNGP02.phx.gbl...
> Slim, instead of keeping asking a lot, giving everyone an image of that
> you are so good at this and never telling anything of value anyway, you
> got the code you asked for before, why don't you show how to do this
> without the popup window? :)
>
let us see the code of your popup and then I may be able to understand where
your going wrong.
You said you wanted to post these rows into a new table, this seems wrong,
as you already have the data, all you need to do is mark that data and link
it to the invoice message. To insert it into a new table you need to submit
to the server, why cant you submit the textarea along with the data you
have?
You have the data on the page, what is the next action, are you going to
insert it into a new table?
if so it is simple, write your mesage into the text box and submit it also.
> Jen.
>
> "Slim" wrote in message
> news:%2346$Q3BJHHA.2312@TK2MSFTNGP02.phx.gbl...
>> There was no need to use a popup window. Popups are messy way to gain
>> input
>>
>> Can we see the code of your popup window?
>>
>> Is this code produced by some sort of editor?
>>
>>
>> "Jen" wrote in message
>> news:%23Rm4U7AJHHA.4068@TK2MSFTNGP03.phx.gbl...
>>> Got it working using a popup window. Thanks to all and a merry
>>> christmas.
>>>
>>> Jen.
>>>
>>
>>
>
>
Re: Textarea outside of loop
am 20.12.2006 13:54:36 von reb01501
Jen wrote:
>> Now we have a fundamental problem. Nothing server-side can be
>> refreshed without a form submission. This is pretty basic. In order
>> for something to happen on the server, something has to be sent to the
>> server.
>>
>> Using an xmlhttp object, data can be submitted to the server without
>> leaving/refreshing your page. This again is client-side code so I'm
>> going to ask you to google the subject and post any further question
>> you have to a client-side group.
>>
>
> Please, I do understand this server-side/ client-side refresh
> problem, thats the core of my problem, no need to stress this out
> forever and ask me to leave the group only if you don't have the
> answer to my initial basic question. The refresh-thing wont work.
>
The fact that you say "refresh" makes me doubt this. But let's leave that
aside.
I didn't ask you to "leave this group": I asked you to post client-side
scripting questions to a more appropriate group. If you have asp-related
questions, I hope you will continue to post them here.
>
> You were basically wrong in your earlier statements?:
>
> "simply assign the text in the
> textarea to a variable and use that variable in your insert
> statements. Why would you even be thinking about a popup window?"
No, I wasn't wrong. I was perfectly correct.
I think I now understand what you were doing with that popup window: you had
a form in it which you used to submit the value to the server, correct?
I reiterate: it is not necessary to do this. You can use xmlhttp (as I said
in my earlier post) to submit data to the server without submitting the rest
of the page ("refresh" as you called it). At the risk of perpetuating this
thread in the wrong newsgroup, here is a working example:
First create a page that does nothing but handle the value from the textarea
and returns a success/failure code:
HandleTextArea.asp:
<%
dim textvar
textvar=Request.Form("txt_egen_fakturatext")
'mitigate sql injection attacks*
textvar=replace(textvar,"'","''")
sql="insert ... values ('" & textvar & "')"
on error resume next
'execute the sql
if err<>0 then
Response.Write "1"
else
Response.Write "0"
end if
%>
* If you would like more information about avoiding sql injection in your
server-side code, please let me know and I will provide it.
Then use xmlhttp to submit the textarea value:
SubmitByXMLHTTP.htm:
onchange="handleChange(this);">
I used the .htm file extension to reiterate that this is a client-side
scripting question. If you have any questions about the code in this
example, please take them to m.p.scripting.jscript.
Of course, if you have questions about the server-side vbscript contained in
HandleTextArea.asp, feel free to ask them here.
I'm now late for work. I am also done with this thread unless asp-related
questions are asked.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"