Extension:Page Forms/Creating query forms/es

This page is a translated version of the page Extension:Page Forms/Creating query forms and the translation is 38% complete.

Los formularios también se pueden utilizar para hacer consultas, en lugar de añadir o editar datos. To do so, use the Special:RunQuery page, which displays a form in a manner similar to Special:FormEdit, but with no associated 'target page'. En cambio, cuando el usuario envia el formulario pulsando el botón "ejecutar respuesta" ve como se ve la plantilla cuando se muestra con los valores que ingresó.

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.

Example of a query form - Try it !.

El boton "Ejecutar respuesta"

By default, button Run query shows up at the bottom of forms if they are accessed via Special:RunQuery. You can change the location and text of this button, using the tag "{{{standard input|run query}}}" (or "{{{standard input|run query|label=...}}}", etc.) within the form definition.

Consulte la parte etiqueta "entrada estándar" (manual Definición de formularios) para obtener más información.

Formularios de respuesta en la parte superior

If you add the parameter "query form at top" to the {{{info}}} tag, the query input field will show up at the top of the results page, instead of the bottom.

creando enlaces para formularios de consulta

Una vez que se ha creado un formulario de consulta puede vincularlo usando una sintaxis similar a esta:

[[Special:RunQuery/nombre del formulario de consulta]]

However, the preferred solution, because it's easier and more powerful, is to use the #queryformlink parser function. A basic call to that function would look like:

{{#queryformlink:form=query form name}}

Here's the complete syntax of #queryformlink:

{{#queryformlink:form=|link text=|link type=|query string=parámetros de cadena de consulta|tooltip=|popup}}

Los parámetros son casi idénticos a los utilizados por #formlink; para una explicación completa de los parámetres, vea [[Special:MyLanguage/Extension:Page Forms/Linking to forms#Using .23formlink Estos usar #formlink]] (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. Para hacerveso, agregue lo siguiente en una página donde desee que aparezca el formulario de consulta:

{{Special:RunQuery/nombre del formulario de consulta}}

De manera similar, puede insertar varios formularios de Special:RunQuery en la misma página.

Recargando datos en la consulta

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

Special:RunQuery/form-name?template-name[item-name]=value

For example, like this:

http://discoursedb.org/wiki/Special:RunQuery/Item_query?Item_query[author]=John

The construction item-name might cause a problem in connection with the wiki markup, and therefore the square brackets— [ and ] —can be replaced with either %5B and %5D, or [ and ]).

Finally, make sure that the case in the query string matches the declaration in the form (e.g., {{{for template|Item_query}}} must match ?Item_query[author]=John and {{{for template|item_query}}} must match ?item_query[author]=John).

Alternatively, you can preload data by using the default= 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 _run to the query string, like the following:

http://discoursedb.org/wiki/Special:RunQuery/Item_query?Item_query[author]=John&_run

 Example of item query - Try it ! 

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

{{#queryformlink:form=Item_query|query string=Item_query[author]=John&_run}}