Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
passing a variable parameter to inline
ravio
Have not tried doing that yet, just wanted to quickly find out if it is possible.
Currently we have all templates with a multi-select item being populated by an inline callout reading from a text file.
Requirement is that for one particular category of templates,
To pass a parameter to an inline callout. The parameter will depend on value obtained from another field in the form.
In other words, a variable is to be passed as argument to the inline command.
This parameter will then be used as a variable in a query for fetching some data from the DB.
The data will then be displayed in a multi-select box.
---------------------------------------------------------------------------------------------------------------------------
Or if some one could suggest any other method of achieving the end result => user selectable values in the multi-select box on the parent form.
With the constraints described above.
Using cgi-callout is an option.Though I want to avoid it if possible because it will offset the user experience by a bit since, rest of the categories of templates will not be using this functionality for the same fields.
ENV:TS 6.5(Sol)
Find more posts tagged with
Comments
Adam Stoller
Passing a parameter - yes.
Passing a programmatically determined paramater - I don't think so. The only way you could do it programmatically is using FormAPI and inline scripts are processed long before FormAPI is available.
However - the inline script, itself, could programmatically determine context (based on environment variables) and potentially in conjunction with a command-line paramater used that information to do what you want.
However - the inline script is run in order to construct the DCT that will be used to render the DCR - so the DCR information isn't available yet - which means you wouldn't be able to create code that relies on determining the value from some other field in the form - but the values don't exist yet.
So - I don't think inlines will do what you want to do here.
FormAPI and/or cgi-callouts are probably your only choice for this kind of customization.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
JeremyH
The variables that are available to an inline are very limited. You can, however, pass in any value you would like - however, they are generally hardcoded in the template. If you you can hardcode the value, then this approach would work. Otherwise, you would be best with formAPI.
If the user can change the other value on the template (and thus change the 'inline') then you will want to set an event on the 'source' field. This event will call javascript that will likely run a cgi script that will then read the database, and write out javascript to update the form field.
ravio
The issue really is to be able to show dynamic option key=value's in the combo-box on the parent DCT.
So, if I understand what you have suggested,
1. I set an onItemChange event on the field
2. which triggers a callserver call
3. which gives me a bunch of rows
4. which I have to use as option items in the combo-box on the DCT
And I am not sure how to use form api to carry out step 4.
It would be great if you could give an example.
….any helpful RTFM’s appreciated.
JeremyH
Look in the TST formAPI manual under the option list commands.
There are also some examples in:
/opt/iwov/iw-home/examples/Templating/templatedata/userscript
Your call server js will pass the form value to the FormAPI CGI. When the CGI gets the data from the db, it will create javascript that will use the formapi to create an optionlist and update the existing DCT with that optionlist.