Extension:Semantic Forms Select/fr

The Semantic Forms Select extension generates a select form element which option values are from semantic query or parser function. (originally Semantic Forms) provides useful input type for select elements such as dropdown, combobox, and listbox. Leurs valeurs peut être tirée de listes statiques, de pages d'une catégorie, de concept, des valeurs autorisées d'une propriété... Quoi qu'il en soit, le choix est limité.

Cette extension fournit ces caractéristiques


 * Les valeurs des options d'un élément select proviennent d'une requête SMW ou d'une fonction parser.
 * Si la requête SMW ou la fonction parser n'a pas de paramètres, les valeurs d'option sont chargées au moment de la génération du formulaire.
 * Si la requête SMW ou la fonction parser nécessite des paramètres, en d'autres termes, ses valeurs dépendent d'un autre champ. Ses valeurs sont chargées par une requête ajax lorsque le champ déclencheur est changé.

Utilisation
Deux champs de formulaires sont impliqués. The first one is the form field we are trying to define. It is termed as Select field. The second one is the field the Select field depends on. It is termed as Value field. A change of Value field will trigger the loading of Select field.

Requête et paramètres de fonction
The input type from this extension is SF_Select. Field parameters are shown in the table below.

Query And Function format
In the above example, the query is |format=list|sep=,|link=none|headers=hide|limit=5000. To avoid parsing and text transform, we have to convert [ to (, = to ~ and | to ; in the query.

Parser function follows the same rule. The parser function is ask in example above. We can of course use other valid parser function. To fit a parser function into field definition, Strip the at the beginning and the end of normal parser function format.

The result from query or parser function should be a list of string separated by comma.

Exemple 1 : requête statique
Values are retrieved when the form is loaded.

Exemple 2 : fonction statique
Values are retrieved when the form is loaded.

Here the getallusers is a custom parser function which gives all users in current installation.

Exemple 3: Requête/fonction paramétrique
The parameter is the special character string @@@@. Dans cet exemple, le champs Select est P2Protocols3. The Value field is Project1. Both Select field and Value field are in the same template since we have sametemplate in field definition. If Value field is from another template, the template parameter should be used. When Project1 field changes, the @@@@ will be replaced by the value of Project1's value. The query is then sent to server through ajax call. The results will be the option values for P2Protocols3 field. If the current template is multiple, the P2Protocols3 only depends on the Project1 in the same instance.

In this case above, when adding a property to be shown (Has Name) and an extra  parameter, the property value is shown instead of the resulting page name.

Parser functions can be parametrized in the same way. In this example, we list all users in the selected group of Group field.

In case the queried results contain a comma as a separator one has to choose another separator like e.g. an asterisk (*). Use it both in the query and in the parser function.

Example 4: rmdiv
In this example, the Endpoint field depends on P2Protocols4 field in study template. The current template is also a multiple template. Endpoint's value is reloaded after P2Protocols4 changes. After reloading, Endpoint may not have any selected values and it is left in an invalid state. In this case, we may want to automatically remove the current instance. This is what rmdir parameter is for.

Installation
The extensions Semantic MediaWiki and Page Forms are required and should be included before this extension in order to work.


 * To install this extension:
 * 1) Use :
 * 2) Add the following line to your "LocalSettings.php" file after invoking the extensions Semantic MediaWiki and Page Forms:
 * 3) Done!

Remerciements
This project was sponsored by BioTeam and flexdms.

For support, please send email to the user mailing list of Semantic MediaWiki.