Forum OpenACS Q&A: Re: How are xowiki.Formfields of type form_page specified?

A little more information.....I have now tried this:

{af_hotels:optional,form_page,form=hotels,label=Hotels}

....which works and provides an unfiltered list of hotels in the combo/dropdown box. However, why is my where clause returning no rows?

,where=ht_iata_code='MCO',

As a result I now have another question! With the above shown formfield specicifation, it is the _title field that appears in the dropdown. Is it possible to specify a different field to be displayed (i.e. in this example the IATA code field)?

In this example, it would in fact make more sense to have a selector in the 'hotels' form that allowed the selection of an airfield, instead of the other way around. However, if I do that I would want to list the ICAO codes rather than the airfield names stored in the _title field.

I hope this makes sense?

What an immensely powerful tool this is! 😊

Regards
Richard

Concerning the first question: in case the hotel form defines ht_iata_code as a text field (type text), your example should works, when you remove the single quotes around MCO.

The where clause is translated either to a tcl-based filter (fetching all instances of the form into memory and applies the filter afterwards) or - when configured - maps this into a postgres hstore query (when hstore is available in your postgres installation and the parameter use_hstore is used). The hstore stuff is currently still part of the xowf package, where fast fetching via instance attributes is necessary for larger apps (we use frequently xowf based questionnaires with several thousand participants). I am mentioning this since for the automatic query transformations, not all form field types are currently supported by the translator (this is done by the method filter_expression of FormPage).

Concerning the second question: the use of the title as label for the options was hard-wired. i've modified the code such one can use for form-field-type "form_page" the attribute "entry_label". It can be used in the form-constraints like "label" etc. Using e.g ...,entry_label=ht_iata_code,....