Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 02 DEC 2003 06:30:49PM Brad Carps wrote:

I have an OECGI question. I have an HTML form with a multiple selection field, and inet_queryparam only returns the first value of the field. Since the CGI query string looks something like this:

?vendors=Company1&vendors=Company2&vendors=Company3&vendors=Company4

and…

– list=inet_queryparam('vendors')

… returns 'Company1' only, does anyone have any idea how I can parse this multiple selection field into something like a @vm-delimited list?


At 03 DEC 2003 03:43AM Oystein Reigem wrote:

Brad,

Here's a function I wrote for a different purpose. I have translated my Norwegian explanation to English so you can see what it's about.

As you see I pick my query parameters from Request without using function Inet_QueryParam. You can do the same.

You might even be able to use my code as a basis for your own version of Inet_QueryParam. There is a while loop where I look for the correct parameter. After I find the parameter (at Found=true$) the parameter value is in QueryParamPPos, len(QueryParam). You just append this value to a dynamic array of your own, and change the loop programming so the loop doesn't stop but runs through the whole of QueryParams until all values for the parameter have been picked up and placed in the array.

<code>
function Inet_QueryParam_R( Request, ItemName )

	/*
	
	erstatning for Revelation sin feilaktige Inet_QueryParam.
	feilen dens er at den ikke håndterer escapete data rett.
	dersom det f.eks er en escapet & i en query param, dvs kodet som %26,
	unescaper den til & igjen og lager kludder.
	
	feilen er muligens rettet i OI 3.7.2.
	Revelation sier det er rettet en feil som har med=å gjøre.
	
	Revelation sin Inet_QueryParam har 4 parametre:
		Inet_QueryParam(Request, ItemName, DefaultValue, NewValue)
	denne har bare de to første.
	
	obs. parameteren blir returnert unescapet!
	
	------------------
	
	replacement for Revelation's Inet_QueryParam,
	which doesn't handle escaped data correctly.
	example: assume a query parameter itself contains the & character.
	the browser will send back this character encoded as %26.
	but Revelation's version of Inet_QueryParam unescapes the %26 back to &,
	which it afterwards interprets as any other & between parameters.
	
	the error is possibly fixed in OI 3.7.2.
	Revelation say they fixed an error regarding =.
	
	Revelation's Inet_QueryParam function has 4 parameters:
		Inet_QueryParam(Request, ItemName, DefaultValue, NewValue)
	my version only has the first two ones.
	(this can be changed quite easily.)
	
	*/
	
	$insert Logical
	
	$insert Inet_Equates
	
	declare function UnEscape
	
	QueryParams=Request : "&"   /* trick */
	NumQP=count(QueryParams, "&")
	
	Pos=1
	Count=0
	Found=false$
	loop
		Count += 1
	while Count  Num then
				/* too few characters following "%" */
				/* abort conversion */
				I=Num + 1
			end else
				H1=StringI+1, 1
				convert "abcdef" to "ABCDEF" in H1
				H2=StringI+2, 1
				convert "abcdef" to "ABCDEF" in H2
				if index("0123456789ABCDEF", H1, 1) and index("0123456789ABCDEF", H2, 1) then
					NewString := Char( IConv( H1 : H2, "MX" ) )
					I += 3
				end else
					/* characters following "%" not legal hex digits */
					/* abort conversion */
					I=Num + 1
				end
			end
		end else
			NewString := Ch
			I += 1
		end
	repeat

return NewString

</code>

- Oystein -


At 03 DEC 2003 12:10PM Richard Hunt wrote:

Brad,

Change your CGI query string from…

?vendors=Company1&vendors=Company2&vendors=Company3&vendors=Company4

to…

?vendors=Company1+Company2+Company3+Company4

The "INET_QUERYPARAM" will return…

VENDORS=Company1+Company2+Company3+Company4'

then just…

CONVERT '+' TO @VM IN VENDORS


At 03 DEC 2003 09:27PM Bob Carten - wrote:

We have really fixed it in 7.0

Till then, you need code like Oystein's example.

Bob


At 04 DEC 2003 09:52AM Oystein Reigem wrote:

…or Brad can do it like Richard suggests, but I believe he'll then need a little bit of JavaScript in the html page.

- Oystein -

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/7c5f5ac73787b5c085256df000812a28.txt
  • Last modified: 2024/01/04 20:57
  • by 127.0.0.1