logo

New Response

« Return to the main article

You are replying to:

  1. I found another effective method of passing values to an agent which I used to get around the limitation of the Query_String CGI variable.

    First you must create a form tag on your current form.

    <FORM NAME="formsubmit" METHOD="post" ACTION="<agentname>?openagent"> <input type="hidden" name="selecteddocs" value="<Computed Value>"> </FORM>

    Next create input tags for all fields you need to send to the agent inbetween the form tags.

    From your action button on the main form, submit this form which causes the agent associated with the form action to run.

    In the agent you will have to use the functions below to get the values of the fields from the Request_Content CGI variable.

    'This line decodes the request_content field

    request_content_decoded=fnDecode(doc.request_content(0))

    'This line gets the field you are looking for from the decoded data

    fieldvalue = fnGetRCFieldValue(request_content_decoded,"<fieldname>")

    function fnDecode(inString As String) As String Dim L As String Dim M As String Dim R As String Dim P As Integer P% = Instr(inString,"%") If P%>0 Then L$=Left$(inString,P%-1) M$=Mid$(inString,P%+1,2) R$=Right$(inString,Len(inString)-(P%+2)) fnDecode1 = L$ & Chr(Cint("&h" & M$)) & R$ If Instr(fnDecode1,"%") Then fnDecode1 = fnDecode1(fnDecode1) Else fnDecode1 = inString End If End Function

    Function fnGetRCFieldValue( requestContent$, fieldToGet$ ) As Variant 'Owen Enraght-Moony 28-01-99 'returns: the value of a field in the Request_Content CGI var (case sensitive) Dim search$, retStr$, offset%, ends% search$ = fieldToGet$ & "=" retStr$ = "" offset% = 0 ends% = 0 offset = Instr(requestContent$, search) If (offset <> 0) Then offset = offset + Len(search) ends = Instr(offset, requestContent$, "&") If (ends = 0) Then ends = Len(requestContent$)+1 retStr = Mid(requestContent$, offset, ends-offset) End If fnGetRCFieldValue = Trim$(retStr) End Function

    This method is very handy when you have to run an action from a $$viewTemplate for xx form. You can have as many form tags you like and run different agents for each action button.

    Jake, thanks again for all the great tips. This is my immediate contribution for all the tips I have received from your site.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: