I’m trying to create a generic DSP that will load up a list of keys and their values each with a checkbox so that some may be selected for an action to be performed on them (eg deleted).
I’m having a little trouble and would like some assistance…
I know that in PHP and JSP you can pass checkboxes as an array from one page to another for processing - this allows you to have a collection of checkboxes, of which you don’t know the name, which you can then run through to work on.
Does anyone know of anyway that a collection of ‘unknown’ checkboxes can be passed into a Flow service from a DSP?
Or more broadly, does anyone know how to pass ALL the HTTP form values into an invoked Flow service without explicitly declaring each individual one in the Flow service inputs?
Just place all the boxes you like in the DSP. Make sure you name them with the same prefix (eg. “checkbox_nn” where nn is a unique identifier). Each checkbox that is checked will generate a variable named “checkbox_nn” with the value “on” (string) and a variable with the name “checkbox_nnList” with the value “on” as the first position (string list).
By using Java to loop over the pipeline, you can extract each variable matching the name prefix “checkbox_nn” and put them in a separate document you can handle later on.
This is a proven technique. We use it
Good luck, Chris
Thank you very much for your response. I’ll have a go at your suggestion. Sounds promising.
I’ve done some testing with what you suggested and found something very interesting.
I created my form that contained a set of Checkboxes, all of which had the same name (‘testBox’). The value of each was set to a key value that I am interested in (eg: ‘name.First’, ‘name.Surname’) - instead of simply ‘on’.
When I submitted this with two boxes checked, in the pipeline were the following variables:
Name: Type: Value:
testBox String name.First
testBoxList StringList [name.First, name.Surname]
Various testing with one, three and more checkboxes checked, or not checked, showed good results.
It appears as though when a DSP is submitted and contains form elements with the same name, it puts the first value in the variable of that name (eg: ‘testBox’ = ‘name.First’), but also creates an array with the ‘List’ suffix (eg: ‘testBoxList’) which contains all of the values from the form elements of that name. (Just like in other web language I’ve used before…)
Thank you very much for your direction on this. Exceptionally helpful.
Does this method work for JSP’s and a select box with multiple select turned on? I tried it and it doesn’t seem to work.
I have a select box named “test” in a form. It has 5 options to select from. If I select 3 of them and submit the form, I’m expecting a variable named “testList” in the pipeline but I am not seeing it. Any help?
I’ve never used JSPs with webMethods before, so I’m not familiar with how they interact with services, etc.
I’ll do some research and get back to you with what I find.
I’m assuming that you are trying to send data to a service from a web page generated by JSP. Now, essentially DSP, JSP, etc, as far as the browser is concerned, is the same as HTML - how its generated at the server is different. Given that, I’ve put together this little test…
- Take the html file and save it to your desktop.
- In wM Developer, create a Package (eg: testUtils)
- Create a folder in the package (eg: testUtils)
- Create a Java Service in the folder, call it testPipeline
- Give it a single output String called pipelineOut
- Open the java snippet file and copy its contents into the Java Service. This code, simply runs over the pipeline and adds the keys and values to the output string.
- Edit the html file: Edit Form Action to point to your server and port
- Load the html file in IE.
- Select a number of items in the simple select list and submit the form
- The output will show you all the variables in the pipeline - you should have a selectTest and a selectTestList entry, and the pipelineOut string showing it all again as a string.
Essentially this java service is not required as all the pipeline variables are shown in the browser anyway. But it shows that the items are in the pipeline and accessible.
So to answer your original question, yes, this method does work the same way with JSP, and HTML for that matter, in submitting data to a service.