<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linea de Codigo &#187; XForms</title>
	<atom:link href="http://lineadecodigo.com/categoria/xforms/feed/" rel="self" type="application/rss+xml" />
	<link>http://lineadecodigo.com</link>
	<description>/* Programación en la red */</description>
	<lastBuildDate>Wed, 16 May 2012 06:00:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Borrado de campos en XForms</title>
		<link>http://lineadecodigo.com/xforms/borrado-de-campos-en-xforms/</link>
		<comments>http://lineadecodigo.com/xforms/borrado-de-campos-en-xforms/#comments</comments>
		<pubDate>Sun, 25 Nov 2007 01:00:26 +0000</pubDate>
		<dc:creator>Víctor Cuervo</dc:creator>
				<category><![CDATA[XForms]]></category>
		<category><![CDATA[DOMActivate]]></category>
		<category><![CDATA[Form]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[label]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[reset]]></category>
		<category><![CDATA[textarea]]></category>
		<category><![CDATA[trigger]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/2007/11/25/borrado-de-campos-en-xforms/</guid>
		<description><![CDATA[Hace ya tiempo, cuando aprendí a construir formularios con HTML, me hacía mucha gracia que todos los formularios que veía por Internet tenían dos botones. El primero era el que realizaba el envío de la información, mientras que el segundo te borraba el contenido de todo el formulario. Esta claro que no voy a cuestionar [...]]]></description>
			<content:encoded><![CDATA[<div class='dd_post_share'><div class='dd_buttons'><div class='dd_button'><div class='dd-google1-ajax-load dd-google1-995'></div><g:plusone size='medium' href='http://lineadecodigo.com/xforms/borrado-de-campos-en-xforms/'></g:plusone></div><div class='dd_button'><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http%3A%2F%2Flineadecodigo.com%2Fxforms%2Fborrado-de-campos-en-xforms%2F" send="false" show_faces="false"  layout="button_count" width="92"  ></fb:like></div><div class='dd_button'><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://lineadecodigo.com/xforms/borrado-de-campos-en-xforms/" data-count="horizontal" data-text="Borrado de campos en XForms" data-via="" ></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div></div><div style='clear:both'></div></div><div style='clear:both'></div><p>Hace ya tiempo, cuando aprendí a construir formularios con <a href="http://www.manualweb.net/tutorial-html/" title="HTML">HTML</a>, me hacía mucha gracia que todos los formularios que veía por Internet tenían dos botones. El primero era el que realizaba el envío de la información, mientras que el segundo te borraba el contenido de todo el formulario.</p>
<p>Esta claro que no voy a cuestionar la utilidad de los dos botones, ya que útiles son. Pero quién no le ha dado al botón de borrar en vez de enviar, cuando realmente lo que quería era enviar y no borrar. Seguro que a todos nos ha pasado alguna vez y nos hemos visto en la tesitura de volver a introducir todos los datos.</p>
<p>En la especificación de <a href="http://www.manualweb.net/tutorial-xforms/" title="XForms">XForms</a> ¡han eliminado al componente “input type reset”¡..... Pero no del todo. La verdad es que ha dejado de ser un control y ha pasado a ser un “evento de interacción”..... ¿Cómo? </p>
<p>Intentare explicarlo... La idea es que los eventos de interacción sean los que correlacionen los eventos con el modelo de datos de <a href="http://www.manualweb.net/tutorial-xforms/" title="XForms">XForms</a>. Dentro de la categoría de eventos de interacción tenemos, además del <a href="http://www.w3api.com/wiki/XForms:Xforms-reset" title="reset">"reset"</a>, <a href="http://www.w3api.com/wiki/XForms:Xforms-next" title="next">"next"</a> para cuando pasamos al siguiente control del formulario , <a href="http://www.w3api.com/wiki/XForms:Xforms-previous" title="previous">"previous"</a> cuando hacemos lo mismo, pero hacía atrás, <a href="http://www.w3api.com/wiki/XForms:Xforms-focus" title="focus">"focus"</a> para cuando queremos hacer foco en un determinado control,.....</p>
<p>Vale, pero yo quiero poner mi botón de toda la vida en el formulario,......</p>
<p>Lo primero que tenemos que hacer es construir un modelo de datos. Para este ejemplo tampoco nos vamos a inventar un mega-modelo. Hagamoslo sencillo:</p>
<pre class="xml" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;model</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;mipersona&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;instance<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;persona</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;nombre<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/nombre<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;apellido<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/apellido<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;edad<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/edad<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;domicilio<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/domicilio<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/persona<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/instance<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/model<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li></ol></pre>
<p>Si os dais cuenta, los campos del modelo están vacíos. Y es que el evento de interacción reset no borra los campos, sino que lo que hace es volver a poner en el formulario el modelo inicial.</p>
<p>Vamos con el siguiente paso, construyamos el formulario. Para ello nos basamos en dos componentes sencillos: <a href="http://www.w3api.com/wiki/XForms:Input" title="input">input</a> y <a href="http://www.w3api.com/wiki/XForms:Textarea" title="textarea">textarea</a>. De ellos solo tienes que darte cuenta que para hacer referencia a un campo del modelo usan el atributo ref. El código nos quedaría algo así:</p>
<pre class="xml" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;/persona/nombre&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Persona: <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:br</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;/persona/apellido&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Apellido: <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:br</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;/persona/edad&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Edad: <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:br</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;textarea</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;/persona/domicilio&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Domicilio: <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/textarea<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li></ol></pre>
<p>Y ahora llega lo más importante.... Nuestro botón de borrado... Para poner un botón tenemos que usar el componente <a href="http://www.w3api.com/wiki/XForms:Trigger" title="trigger">trigger</a>.</p>
<p>Dentro de este componente es donde pondremos nuestro evento de interacción. La etiqueta del elemento es reset y como atributos tendremos dos: el evento que lo activa que será <a href="http://www.w3api.com/wiki/XForms:DOMActivate" title="DOMActivate">DOMActivate</a> . El evento  <a href="http://www.w3api.com/wiki/XForms:DOMActivate" title="DOMActivate">DOMActivate</a> viene a reflejar la acción por defecto sobre un control, en nuestro caso pulsar el botón. En el caso de que fuese una caja de texto, la acción por defecto sería pulsar "Intro".</p>
<p>El segundo atributo del reset es el modelo que tiene que resetear. Ya que podemos tener varios modelos en nuestra página.....</p>
<pre class="xml" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;trigger<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Borrar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;reset</span> <span style="color: #000066;">ev:event</span>=<span style="color: #ff0000;">&quot;DOMActivate&quot;</span> <span style="color: #000066;">model</span>=<span style="color: #ff0000;">&quot;mipersona&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/trigger<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li></ol></pre>
<p>Bueno, al final, tampoco ha sido tan difícil....<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/xforms/mi-primer-formulario-xforms/" rel="bookmark" title="Noviembre 24, 2007">Mi primer formulario XForms</a></li>
<li><a href="http://lineadecodigo.com/javascript/saber-que-evento-se-ha-producido/" rel="bookmark" title="Enero 2, 2008">Saber que evento se ha producido</a></li>
<li><a href="http://lineadecodigo.com/javascript/controlar-el-envio-de-un-formulario-con-javascript/" rel="bookmark" title="Abril 24, 2009">Controlar el envío de un formulario con JavaScript</a></li>
<li><a href="http://lineadecodigo.com/javascript/quitar-el-foco-de-un-elemento/" rel="bookmark" title="Enero 19, 2008">Quitar el foco de un elemento</a></li>
<li><a href="http://lineadecodigo.com/asp/hola-mundo-en-asp/" rel="bookmark" title="Enero 10, 2007">Hola Mundo en ASP</a></li>
</ul>
<p><!-- Similar Posts took 7.602 ms --></p>
<script type="text/javascript"> jQuery(document).ready(function($) { window.setTimeout('loadGoogle1_995()',1000); }); </script><script type="text/javascript"> function loadGoogle1_995(){ jQuery(document).ready(function($) { $('.dd-google1-995').remove();$.getScript('https://apis.google.com/js/plusone.js'); }); }</script><!-- Social Buttons Generated by Digg Digg plugin v5.2.6,
    Author : Buffer, Inc
    Website : http://bufferapp.com/diggdigg -->]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/xforms/borrado-de-campos-en-xforms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mi primer formulario XForms</title>
		<link>http://lineadecodigo.com/xforms/mi-primer-formulario-xforms/</link>
		<comments>http://lineadecodigo.com/xforms/mi-primer-formulario-xforms/#comments</comments>
		<pubDate>Sat, 24 Nov 2007 06:00:57 +0000</pubDate>
		<dc:creator>Víctor Cuervo</dc:creator>
				<category><![CDATA[XForms]]></category>
		<category><![CDATA[action]]></category>
		<category><![CDATA[Form]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[instance]]></category>
		<category><![CDATA[label]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[namespace]]></category>
		<category><![CDATA[ref]]></category>
		<category><![CDATA[submission]]></category>
		<category><![CDATA[submit]]></category>
		<category><![CDATA[w3c]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/2007/11/24/mi-primer-formulario-xforms/</guid>
		<description><![CDATA[XForms, otra tecnología X*. Un amigo mío dice, en broma, que toda tecnología que evoluciona el W3C le pega la X. Ya lo hizo al evolucionar su HTML al XHTML, las Querys al XQuery y claro está los formularios (Form) a XForms. Vamos, que podríamos decir que estamos delante de una verdadera generación X. ¿Qué [...]]]></description>
			<content:encoded><![CDATA[<div class='dd_post_share'><div class='dd_buttons'><div class='dd_button'><div class='dd-google1-ajax-load dd-google1-993'></div><g:plusone size='medium' href='http://lineadecodigo.com/xforms/mi-primer-formulario-xforms/'></g:plusone></div><div class='dd_button'><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http%3A%2F%2Flineadecodigo.com%2Fxforms%2Fmi-primer-formulario-xforms%2F" send="false" show_faces="false"  layout="button_count" width="92"  ></fb:like></div><div class='dd_button'><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://lineadecodigo.com/xforms/mi-primer-formulario-xforms/" data-count="horizontal" data-text="Mi primer formulario XForms" data-via="" ></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div></div><div style='clear:both'></div></div><div style='clear:both'></div><p><a href="http://www.manualweb.net/tutorial-xforms/" title="XForms">XForms</a>, otra tecnología X*. Un amigo mío dice, en broma, que toda tecnología que evoluciona el <a href="http://www.w3c.org" title="W3C">W3C</a> le pega la X. Ya lo hizo al evolucionar su <a href="http://www.manualweb.net/tutorial-html/" title="HTML">HTML</a> al <a href="http://www.manualweb.net/tutorial-xhtml/" title="XHTML">XHTML</a>, las Querys al XQuery y claro está los formularios (Form) a <a href="http://www.manualweb.net/tutorial-xforms/" title="XForms">XForms</a>. Vamos, que podríamos decir que estamos delante de una verdadera generación X.</p>
<h3>¿Qué es XForms?</h3>
<p><a href="http://www.manualweb.net/tutorial-xforms/" title="XForms">XForms</a> como reza su página del <a href="http://www.w3c.org" title="W3C">W3C</a> es “the next generation of web forms”.... la nueva generación de formularios web. Y es que los formularios <a href="http://www.manualweb.net/tutorial-html/" title="HTML">HTML</a> se nos habían quedado pequeños y había que acometer dos cosas sobre ellos:</p>
<ul>
<li>Separar el modelo de datos del formulario y su diseño visual</li>
<li>Dotar de mayor potencia a los formularios: funciones de trabajo sobre ellos, nuevos componentes visuales,...</li>
</ul>
<p>De las dos cosas mencionadas, la primera es la más importante. Separación de los datos de la presentación. Es por ello que se crea un conjunto de componentes visuales que pueden ser usados dentro de un documento <a href="http://www.manualweb.net/tutorial-xhtml/" title="XHTML">XHTML</a> o cualquier otro documento <a href="http://www.manualweb.net/tutorial-xml/" title="XML">XML</a>.</p>
<p>Por otro lado se define el concepto de instancia de datos. Esto es un modelo de datos que viene a reflejar la estructura de datos que se va a manejar. Estos datos son los que realmente se van a intercambiar.</p>
<p>Estas dos cosas: controles de formulario y la instancia de datos son ligados mediante un procesador <a href="http://www.manualweb.net/tutorial-xforms/" title="XForms">XForms</a> el cual define como se envía y recibe datos.</p>
<h3>Mi primer formulario</h3>
<p>Pongámonos manos a la obra y construyamos nuestro primer formulario basado en <a href="http://www.manualweb.net/tutorial-xforms/" title="XForms">XForms</a>. El movimiento se demuestra andando....Lo primero que tenemos que saber es que vamos a construir un documento <a href="http://www.manualweb.net/tutorial-xhtml/" title="XHTML">XHTML</a>.</p>
<pre class="xml" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:html</span> <span style="color: #000066;">xmlns:h</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:head<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Mi primer formulario XForms<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:head<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> ...</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li></ol></pre>
<p>Si os fijáis en el código. El namespace escogido en mi ejemplo para el <a href="http://www.manualweb.net/tutorial-xhtml/" title="XHTML">XHTML</a>> es h. Esto nos permitirá diferenciarlo de las etiquetas <a href="http://www.manualweb.net/tutorial-xforms/" title="XForms">XForms</a>.</p>
<p>Lo siguiente que tenemos que hacer es incluir el namespace de <a href="http://www.manualweb.net/tutorial-xforms/" title="XForms">XForms</a>. Este, está definido en http://www.w3.org/2002/xforms</p>
<pre class="xml" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:html</span> <span style="color: #000066;">xmlns:h</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">   <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2002/xforms&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li></ol></pre>
<p>En nuestro ejemplo vamos a poner un formulario de búsqueda. No nos vamos a complicar más la vida. Dentro de este formulario pondremos dos campos de entrada de texto y un botón que lance la búsqueda.</p>
<blockquote><p>Lo más interesante de los <a href="http://www.manualweb.net/tutorial-xforms/" title="XForms">XForms</a> es que HA DESAPARECIDO LA ETIQUETA FORM.</p></blockquote>
<p>Para añadir los campos de entrada de texto tenemos el elemento <a href="http://www.w3api.com/wiki/XForms:Input" title="input">input</a>:</p>
<pre class="xml" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Nombre:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:br</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Apellido:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li></ol></pre>
<p>Dentro de la etiqueta input podemos encontrar dos elementos</p>
<ul>
<li><a href="http://www.w3api.com/wiki/XForms:Label" title="label">Label</a>: Para indicar el nombre que se antepondrá al campo de entrada</li>
<li><a href="http://www.w3api.com/wiki/XForms:Hint" title="hint">Hint</a>: Que es una etiqueta de texto emergente que nos servirá de aviso.</li>
</ul>
<p>Para añadir el botón de búsqueda tendremos que trabajar con el elemento <a href="http://www.w3api.com/wiki/XForms:Submit" title="submit">submit</a>. Este elemento tiene asociado un atributo que es <a href="http://www.w3api.com/wiki/XForms:Submission_(Atributo)" title="submission">submission</a>, el cual enlazará con una acción de envío.</p>
<pre class="xml" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;submit</span> <span style="color: #000066;">submission</span>=<span style="color: #ff0000;">&quot;busqueda&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Buscar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/submit<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li></ol></pre>
<h3>Enlazando el formulario con el modelo de datos</h3>
<p>Como hemos dicho en la introducción. <a href="http://www.manualweb.net/tutorial-xforms/" title="XForms">XForms</a> separa los datos de la presentación. El modelo de dato se define dentro de la etiqueta <a href="http://www.w3api.com/wiki/XForms:Model" title="model">model</a>. Y un modelo contendrá una instancia del mismo (definida por el elemento <a href="http://www.w3api.com/wiki/XForms:Instance" title="instance">instance</a>), la cual contendrá los datos.</p>
<p>Veamos como quedaría nuestro formulario con el nombre y apellido como modelo:</p>
<pre class="xml" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;model<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;instance<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;data</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;nombre<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Victor<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/nombre<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;apellido<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Cuervo<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/apellido<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/data<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/instance<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/model<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li></ol></pre>
<p>Si queremos hacer referencia a algún elemento del modelo desde los controles visuales lo haremos mediante el atributo <a href="http://www.w3api.com/wiki/XForms:Ref" title="ref">ref</a>. Así nuestros componentes visuales quedarían de la siguiente forma:</p>
<pre class="xml" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;nombre&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Nombre:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:br</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;apellido&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Apellido:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li></ol></pre>
<p>Dentro del modelo también tendremos la acción desencadenada por el componente gráfico <a href="http://www.w3api.com/wiki/XForms:Submit" title="submit">submit</a>. El elemento que tiene la acción es <a href="http://www.w3api.com/wiki/XForms:Submission" title="submission">submission</a>.</p>
<pre>&lt;submission action="http://example.com/buscar" method="post" id="buscar"/&gt;</pre>
<p>Este elemento tiene múltiples atributos, pero entre ellos destacamos tres:</p>
<ul>
<li><a href="http://www.w3api.com/wiki/XForms:Action" title="action">action</a>, que define la URI donde se enviarán los datos.</li>
<li><a href="http://www.w3api.com/wiki/XForms:Method" title="method">method</a>, que indica que tipo de protocolo se va a utilizar para la serialización de datos: post, get,...</li>
<li>id, identificador que lo hace único y que será usado por el elemento submit para identificar la acción de búsqueda a usar.</li>
</ul>
<h3>Visualizar nuestro trabajo: plug-in para Mozilla</h3>
<p>Solo nos quedará por guardar nuestro ejemplo como .xhtml y probarlo.</p>
<p>Para probar el <a href="http://lineadecodigo.com/tag/markup/xforms/" title="XForms">XForms</a> con Mozilla y FireFox hay que descargarse un plug-in  <a href="https://addons.mozilla.org/firefox/824/">https://addons.mozilla.org/firefox/824/</a> que nos servirá para nuestros ejemplos.</p>
<p>Otros interpretes de <a href="http://lineadecodigo.com/tag/markup/xforms/" title="XForms">XForms</a> están disponibles en <a href="http://www.w3.org/MarkUp/Forms/#implementations">http://www.w3.org/MarkUp/Forms/#implementations</a><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/xforms/borrado-de-campos-en-xforms/" rel="bookmark" title="Noviembre 25, 2007">Borrado de campos en XForms</a></li>
<li><a href="http://lineadecodigo.com/prototype/posicionarse-en-el-primer-elemento-de-un-formulario/" rel="bookmark" title="Marzo 2, 2007">Posicionarse en el primer elemento de un formulario</a></li>
<li><a href="http://lineadecodigo.com/css/boton-con-imagen-de-fondo-en-css/" rel="bookmark" title="Enero 8, 2007">Boton con imagen de fondo en CSS</a></li>
<li><a href="http://lineadecodigo.com/prototype/deshabilitar-formulario-con-prototype/" rel="bookmark" title="Febrero 4, 2007">Deshabilitar formulario con Prototype</a></li>
<li><a href="http://lineadecodigo.com/xforms/botones-con-imagenes-en-xforms/" rel="bookmark" title="Enero 7, 2007">Botones con imagenes en XForms</a></li>
</ul>
<p><!-- Similar Posts took 8.205 ms --></p>
<script type="text/javascript"> jQuery(document).ready(function($) { window.setTimeout('loadGoogle1_993()',1000); }); </script><script type="text/javascript"> function loadGoogle1_993(){ jQuery(document).ready(function($) { $('.dd-google1-993').remove();$.getScript('https://apis.google.com/js/plusone.js'); }); }</script><!-- Social Buttons Generated by Digg Digg plugin v5.2.6,
    Author : Buffer, Inc
    Website : http://bufferapp.com/diggdigg -->]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/xforms/mi-primer-formulario-xforms/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Botones con imagenes en XForms</title>
		<link>http://lineadecodigo.com/xforms/botones-con-imagenes-en-xforms/</link>
		<comments>http://lineadecodigo.com/xforms/botones-con-imagenes-en-xforms/#comments</comments>
		<pubDate>Sun, 07 Jan 2007 22:45:15 +0000</pubDate>
		<dc:creator>Víctor Cuervo</dc:creator>
				<category><![CDATA[XForms]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[IMG]]></category>
		<category><![CDATA[label]]></category>
		<category><![CDATA[trigger]]></category>

		<guid isPermaLink="false">http://lineadecodigo.com/2007/01/07/botones-con-imagenes-en-xforms/</guid>
		<description><![CDATA[Si echamos la vista atrás podemos recordar que con los formularios HTML podíamos tener campos de texto de tipo "image". Estos campos de texto no eran más que una imagen sobre la que se podía pinchar. Luego aparecio la etiqueta button que ya permitía anidar otros elementos. Mediante CSS se daba un nuevo salto y [...]]]></description>
			<content:encoded><![CDATA[<div class='dd_post_share'><div class='dd_buttons'><div class='dd_button'><div class='dd-google1-ajax-load dd-google1-285'></div><g:plusone size='medium' href='http://lineadecodigo.com/xforms/botones-con-imagenes-en-xforms/'></g:plusone></div><div class='dd_button'><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http%3A%2F%2Flineadecodigo.com%2Fxforms%2Fbotones-con-imagenes-en-xforms%2F" send="false" show_faces="false"  layout="button_count" width="92"  ></fb:like></div><div class='dd_button'><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://lineadecodigo.com/xforms/botones-con-imagenes-en-xforms/" data-count="horizontal" data-text="Botones con imagenes en XForms" data-via="" ></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div></div><div style='clear:both'></div></div><div style='clear:both'></div><p>Si echamos la vista atrás podemos recordar que con los formularios <a href="http://www.manualweb.net/tutorial-html/" title="HTML">HTML</a> podíamos tener campos de texto de tipo "image". Estos campos de texto no eran más que una imagen sobre la que se podía pinchar. Luego aparecio la etiqueta <a href="http://www.w3api.com/wiki/HTML:BUTTON" title="button">button</a> que ya permitía anidar otros elementos. Mediante <a href="http://www.manualweb.net/tutorial-css/" title="CSS">CSS</a> se daba un nuevo salto y las propiedades permitían jugar con el color e imagen de fondo del botón. Con <a href="http://www.manualweb.net/tutorial-xforms/" title="xforms">XForms</a> vamos un paso más allá y aquí se pueden construir botones con imágenes, mediante la etiqueta <a href="http://www.w3api.com/wiki/HTML:IMG" title="IMG">IMG</a> de <a href="http://www.manualweb.net/tutorial-html/" title="HTML">HTML</a>. Algo parecido al elemento <a href="http://www.w3api.com/wiki/HTML:BUTTON" title="button">button</a> de <a href="http://www.manualweb.net/tutorial-html/" title="HTML">HTML</a>. Y todo de una forma muy sencilla.</p>
<p>Lo primero que tenemos que ver es cómo construir un botón. Para ello nos valemos de la etiqueta <a href="http://www.w3api.com/wiki/XForms:Trigger" tittle="trigger">trigger</a>. La verdad es que esto ha sido un cambio bastante sustancial con respecto a los <a href="http://www.w3api.com/wiki/HTML:BUTTON" title="button">button</a> del <a href="http://www.manualweb.net/tutorial-html/" title="HTML">HTML</a></p>
<p>Anidada a la etiqueta <a href="http://www.w3api.com/wiki/XForms:Trigger" tittle="trigger">trigger</a> utilizaremos <a href="http://www.w3api.com/wiki/XForms:Label" title="label">label</a> para indicar el texto que va sobre el botón. Teniendo un código similar al siguiente:</p>
<pre class="xml" style="font-family:monospace;">&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;trigger<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Mi boton<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/trigger<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre>
<p>Incrustar una imagen como elemento del botón será un procedimiento muy sencillo, ya que bastará con utilizar la etiqueta <a href="http://www.w3api.com/wiki/HTML:IMG" title="IMG">IMG</a>, referenciando a la imagen que queramos usar, como valor del label del botón</p>
<pre class="xml" style="font-family:monospace;">&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;trigger<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;h:img</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;documento.gif&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/trigger<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre>
<p>Como se puede observar, algo muy sencillo de codificar y muy útil en cuanto al diseño. Toda una novedad de <a href="http://www.manualweb.net/tutorial-xforms/" title="xforms">XForms</a>.</p>
<p>Veamos como sería el código completo:</p>
<pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:html</span> <span style="color: #000066;">xmlns:h</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span></span>
<span style="color: #009900;">   <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2002/xforms&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:head<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Mi primer formulario XForms<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:head<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;trigger<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;h:img</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;documento.gif&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/trigger<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;trigger<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Mi boton<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/trigger<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre>
<p><a href="http://www.getfirefox.com" title="firefox">FireFox</a> ya da soporte a la especificación de <a href="http://www.manualweb.net/tutorial-xforms/" title="xforms">XForms</a>, aunque, que yo sepa incompleto. Puedes encontrar otros interpretes de <a href="http://www.manualweb.net/tutorial-xforms/" title="xforms">XForms</a> en <a href="http://www.w3.org/MarkUp/Forms/#implementations" title="interpretes xforms">http://www.w3.org/MarkUp/Forms/#implementations</a><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://lineadecodigo.com/xforms/mi-primer-formulario-xforms/" rel="bookmark" title="Noviembre 24, 2007">Mi primer formulario XForms</a></li>
<li><a href="http://lineadecodigo.com/javascript/crear-elementos-html-con-javascript/" rel="bookmark" title="Septiembre 9, 2007">Crear elementos HTML con JavaScript</a></li>
<li><a href="http://lineadecodigo.com/wforms/todos-los-campos-del-formulario-obligatorios/" rel="bookmark" title="Octubre 28, 2007">Todos los campos del formulario obligatorios</a></li>
<li><a href="http://lineadecodigo.com/xforms/borrado-de-campos-en-xforms/" rel="bookmark" title="Noviembre 25, 2007">Borrado de campos en XForms</a></li>
<li><a href="http://lineadecodigo.com/css/poner-un-fondo-en-mi-pagina-web/" rel="bookmark" title="Mayo 28, 2011">Poner un fondo en mi página web</a></li>
</ul>
<p><!-- Similar Posts took 8.186 ms --></p>
<script type="text/javascript"> jQuery(document).ready(function($) { window.setTimeout('loadGoogle1_285()',1000); }); </script><script type="text/javascript"> function loadGoogle1_285(){ jQuery(document).ready(function($) { $('.dd-google1-285').remove();$.getScript('https://apis.google.com/js/plusone.js'); }); }</script><!-- Social Buttons Generated by Digg Digg plugin v5.2.6,
    Author : Buffer, Inc
    Website : http://bufferapp.com/diggdigg -->]]></content:encoded>
			<wfw:commentRss>http://lineadecodigo.com/xforms/botones-con-imagenes-en-xforms/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: lineadecodigo.com @ 2012-05-17 20:09:18 by W3 Total Cache -->
