Forum OpenACS Q&A: Can I pass arbitrary variables to xowiki pages in the url?

I'd like to create an ::xowiki::FormPage that will display content dependent upon a url var. Can I pass in arbitrary values when I request the page?

http://my.site.com/my_page?my_var=/path/to/file

If so, how do I reference the value for my_var in the xowiki includelet declaration for which I have a field in my ::xowiki::Form.

i.e.

{{yui-carousel -mode 1 -spotlight_size 400x300 -title "Gallery" -image_size 80x60 -num_visible \[5,2\] is_circular true -animation {speed: 1, effect: null} -form en:photo.form -folder ***I want my_var here***}}

Regards
Richard

yes, one can pass parameters to includelet arguments, but only when no actual arguments are provided in the includelet specification. For example, consider a page containing two includelets:
{{recent}}
{{recent -max_entries 5}}
The first includelet hat no actual arguments provided, the second one -max_entries 5. If one calls this page (the page with the two includelets) with a query-parameter ...?max_entries=2 then the value of 2 value is honored by the first includelet, but not by the second (idea: the hard-coded value in the page takes precedence over the query-parameter, which can be altered by the user.

Alternatively, one can as well provide a form-based interface to configure the includelets: Define a form with the content

{{recent -max_entries @nrEntries@}}
and the form constraints
nrEntries:numeric,format=%d,default=3
When an instance of this form (a form page) is created, one can edit the value of nrEntries via the form. This value is passed as an argument of the includelet. One can certainly define as well other interactions, such as a pull down menu with predefined values, etc. by changing the form constraints.

-gustaf neumann

Gustaf,

Thank you for the reply. I am a little confused though about this.

I have an ::xowiki::Form that has various fields for content to enable the creation of new FormPages that are automatically styled. One of the fields is an includelet specification field in which I am in this example putting the carousel includelet.

Instead of creating an instance of the FormPage with the folder that contains the images hard-coded into the includelet specification for every set of pictures, I would like to be able to provide the folder_id for the images to display from a value passed in the url.

Am I correct in understanding that I should create the minimal forms you describe above (which when allocated a category will naturally appear in the dropdown menu), and then include these forms in the page?

So essentially we would have a carousel embedded within a form, which itself is embedded in a form?

Regards
Richard

Ah! It's ok. I see. I had effectively already done this, and was getting confused by trying to re-use a single formpage. However, I was collecting the entire includelet spec in a formfield. I can't then reasonably expect to be able to substitute another @value@ into the result of an already substituted @formfield@! This would require nested substitutions within a single ::xowiki::Form!! 😱

If I put the fixed part of the includelet declaration into the ::xowiki::Form spec, then I see that I could add a hidden field to the form and pass in values using a query parameter in the url. The disadvantage with this is that then I would lose the ability to add SEO content to the resulting carousel page, which has other fields specifically for this purpose, and any case, to drive a menu you would have to have an instance of one form or the other for each folder of pictures.

I apologise that this may be a bit confusing to read, but I have posted it as a record for future reference.

R.

I'd like to have a small form at the top of a page documenting a manual installation process, such as installing openacs... and have the values in that form substitute on the same page when the form is submitted.
Jim,

Not exactly clear what you mean. Do you mean an html form for collecting user input, an ::xowiki::Form for collecting data input, or an ::xowiki::FormPage for displaying information that is already in the database?

Perhaps you could provide a little more detail.

Regards
Richard