about javascript and asp

  • i have a asp page " ADDRESS_BOOKfw.asp"

    and in it there is a form named

    what it does is it submits to itself with a parameter add=1 which

    there is an if condition for this parameter

    if request.querystring(add")=1 then

    '/// process the code

    end if

    now what i want is after processing the code

    it should submit itself to another asp page that is

    compose_msg.asp?from=1

    with para from=1

    below is the full code, but its not working properly

    has code written in the para

    if Request.QueryString("add")="1" then

    'Response.Write Session("Msg")

    sql="delete from RMCPL_MAIL_TR WHERE RMCPL_MSG_CD=" & session("msg")

    'Response.Write Session("Msg") & "From 2"

    'Response.End

    con.Execute(sql)

    rsel.Open "Select * from RMCPL_MAIL_TR WHERE 1=2",con,1,3

    'INSERTING FOR SENT ITEMS

    rsel.AddNew

    rsel("RMCPL_MSG_CD")=SESSION("msg")

    rsel("RMCPL_TOCD")=SESSION("usr")

    rsel("RMCPL_FRMCD")=SESSION("usr")

    rsel("RMCPL_FLAG")="F"

    rsel("RMCPL_TYPE")="N"

    rsel("RMCPL_SNT_TYPE")="S"

    rsel.Update

    WHILE not rsemp.EOF

    if Request.Form("N" & rsemp("RMCPL_EMP_CD")) <> "" then

    rsel.AddNew

    rsel("RMCPL_MSG_CD")=SESSION("msg")

    rsel("RMCPL_TOCD")=Request.Form("N" & rsemp("RMCPL_EMP_CD"))

    rsel("RMCPL_FRMCD")=SESSION("usr")

    rsel("RMCPL_FLAG")="F"

    rsel("RMCPL_TYPE")="N"

    rsel("RMCPL_SNT_TYPE")="N"

    rsel.Update

    end if

    if Request.Form("C" & rsemp("RMCPL_EMP_CD")) <> "" then

    rsel.AddNew

    rsel("RMCPL_MSG_CD")=SESSION("msg")

    rsel("RMCPL_TOCD")=Request.Form("C" & rsemp("RMCPL_EMP_CD"))

    rsel("RMCPL_FRMCD")=SESSION("usr")

    rsel("RMCPL_FLAG")="F"

    rsel("RMCPL_TYPE")="C"

    rsel("RMCPL_SNT_TYPE")="N"

    rsel.Update

    end if

    rsemp.MoveNext

    wend

    Response.Write "<script Language='JavaScript'>"

    Response.Write "function clp(){"

    Response.Write "alert('Address book entered Successfully.');"

    '-- problem is here now iam changing the action page and iam submitting it but its not working

    ---------------

    Response.Write "document.f1.action ='compose_msg.asp?from=1'"

    Response.Write "document.f1.submit();"

    <a href="http://www.websolsoftware.com"> For IT jobs click here</a>

    *Sukhoi*[font="Arial Narrow"][/font]

  • This is not a T/SQL question. In fact it's not even a SQL question. But here's my response anyway ...

    The question is: Do you want to "redirect" the page after the address has been added, or do you want to "post all the data", that has been posted to this page, to another page.

    So, if you want to redirect the page you cannot write any information to the client (i.e. you cannot use response.write). But what you can do is, right at the top of your asp page (before any HTML) write:

       Response.Buffer = True

    and then to redirect the page you can write:

       Response.Clear

       Response.Redirect "MyURL.asp?MyParam=xyz"

    If you want to "post all data" it becomes a little more complicated, and if this is the case, please let me know and I'll post the code.


    ----------------------------------------
    Pascal Dobrautz
    www.sqlassi.net

  • yes yes, i want to post the data,

    to another asp pages.

    Pls Help

    <a href="http://www.websolsoftware.com"> For IT jobs click here</a>

    *Sukhoi*[font="Arial Narrow"][/font]

  • Pls Answer my question

    <a href="http://www.websolsoftware.com"> For IT jobs click here</a>

    *Sukhoi*[font="Arial Narrow"][/font]

  • Hi Sukhoi,

    sorry it took so long, but here it is:

    <%@ Language=VBScript %>

    <% Option Explicit 'I always have this. Helps you find misspelt variables quickly %>

    <%

    Response.Buffer = True

    'more code codes here ....

    If Request.QueryString("add" ) = "1" Then

        'Do your subitted stuff here ...

        

        'Once you are done, Call the RedirectForm method

        Call RedirectForm("compose_msg.asp?from=1", False)

    End If

    'This is the RedirectForm method. It takes the following variables:

    '    URL - String value representing the target URL.

    '    IncludeQueryString - Boolean value indicating whether the function should retrieve and append the query string

    '                     that was posted to this page to the target URL.

    Sub RedirectForm(ByVal URL, ByVal IncludeQueryString)

        Dim strParameters, qs, frm

        

        'First get the query string elemts if required

        strParameters = ""

        If IncludeQueryString Then

            For Each qs In Request.QueryString

                If strParameters <> "" Then strParameters = strParameters & "&"

                strParameters = strParameters & qs & "=" & Server.URLEncode(Request.QueryString(qs))

            Next

            If strParameters <> "" Then

                If InStr(1, URL, "?" ) = 0 Then

                    strParameters = "?" & strParameters

                 Else

                    strParameters = "&" & strParameters

                End If

            End If

        End If

        

        'Now clear the buffer and write the form information to redirect the form

        Response.Clear

        Response.Write "<html><head><title></title></head><body onload=""javascript:document.frm.submit();"">"

        Response.Write "<form name=""frm"" id=""frm"" action=""" & URL & strParameters & """ method =""post"">"

        For Each frm In Request.Form

            'Replace the " with &quote since Server.HTMLEncode doesn't do this

            Response.Write "<input type=""hidden"" name=""" & frm & """ id=""" & frm & """ value=""" & Replace(Server.HTMLEncode(Request.Form(frm)), """", "&quot;" ) & """>"

        Next

        Response.Write "</form></body></html>"

        Response.Flush

        Response.End

    End Sub

    %>


    ----------------------------------------
    Pascal Dobrautz
    www.sqlassi.net

  • the only way out is to store those items as session variables,

    eg assuming you have var1, var2, var3 .. varn

    you can have

    session("v1") = var1

    session("v2")= var2

    session("v3") = var3

    ...

    session("vn") = varn

    then response.redirect as earlier suggested by somebody

    in the new page

    you can retrieve you data back by assigning those session variable back variable in the new page i.e

    nv1 = session("v1")

    nv2 = session("v2")

    nv3 = session("v3")

    ...

    nvn = session("vn")

    I think that should work

    mayowa

  • what iam doing is enabling an forward option

    there is an internal email system in our web based ERP,

    and i cannot use querystring option to transfer data becoz

    text messages are too big some 2-3 pages of word files

    i know something like i can create a temp data at a client side and then use something like that,

    any clue ??

    <a href="http://www.websolsoftware.com"> For IT jobs click here</a>

    *Sukhoi*[font="Arial Narrow"][/font]

  • pls answer to my question especially think about my second last post.

    what about creating temp data file at client side,

    any idea, what exactly to do

    <a href="http://www.websolsoftware.com"> For IT jobs click here</a>

    *Sukhoi*[font="Arial Narrow"][/font]

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply