Extension:Page Forms/Creating query forms/es

Los formularios también se pueden utilizar para realizar consultas en lugar de agregar o editar datos. To do so, use the  page, which displays a form in a manner similar to , but with no associated 'target page'. Instead, when the user submits the form by hitting the "Run query" button, they see what the template looks like when displayed with the values they entered.

The template that the form uses should most likely contain one or more queries (using Semantic MediaWiki inline queries, Cargo queries, External Data queries, etc.) to query data using values that the user entered. You can see an example of a query form here.

The "Run query" button
By default, a button called "Run query" shows up at the bottom of forms if they are accessed via. You can change the location and text of this button, using the tag " " (or " ", etc.) within the form definition.

See part "standard input" tag (Defining forms manual) for more information.



Formulario de consulta en la parte superior
If you add the parameter " " to the  tag, the query input field will show up at the top of the results page, instead of the bottom.



Creación de enlaces a los formularios de consulta
Una vez que se ha creado un formulario de consulta puede vincularlo usando una sintaxis similar a esta:



nombre del formulario de consulta A basic call to that function would look like:



Here's the complete syntax of :



Los parámetros son casi idénticos a los utilizados por ; para una explicación completa de los parámetres, vea Special:MyLanguage/Extension:Page Forms/Linking to forms (Special:MyLanguage/Extension:Page Forms/Linking to forms Crear vínculos con los formularios manual).



Incrustar formularios de consulta
You can also embed a query form within another page. To do that, add the following in a page where you want the query form to appear:



You can similarly embed multiple  forms in the same page.

Preloading data in the query
In case query data needs to be pre-loaded, the  should follow the convention:



For example, like this:



The construction   might cause a problem in connection with the wiki markup, and therefore the square brackets—  and   —can be replaced with either   and , or   and  ).

Finally, make sure that the case in the query string matches the declaration in the form (e.g.,  must match   and   must match.

Alternatively, you can preload data by using the  parameter for form fields.

Displaying results automatically
The above technique will produce pre-selected values in the form, but the user will still has to press the "Run query" button to see the results of the query. If you want the results to be displayed automatically as well, you simply have to add  to the query string, like the following:



You can see a live example of this here.

As before, the recommended way to link to such a page internally is with ; such a call would look as follows: