<?xml version="1.0" encoding="UTF-8" ?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Posteet: formularios</title> 
    <link>http://www.posteet.com/</link> 
    <description>Recent posteets posted to Posteet</description>
    <ttl>60</ttl>

    
    <item>
        <title>colocar un item por defecto a un combo relacionado</title>
        <link>http://www.posteet.com/view/1897</link>
        <description>
        <![CDATA[<pre>//MenuCardTable.class
public function getMenuCardForCombo(){
        $q = Doctrine_Query::create()
          -&gt;select('m.*')
          -&gt;from('MenuCard m');
        $results = $q-&gt;execute();

        foreach($results as $menu){
            $choice[$menu-&gt;getId()] = $menu-&gt;getName();
        }

        return $choice;
    }

====================no funciona para validar &quot;required&quot;=========================================
//DishesForm.class
        $choices = array('Seleccione un item') + Doctrine::getTable('MenuCard')-&gt;getMenuCardForCombo();
        $this-&gt;widgetSchema['menu_card_id'] = new sfWidgetFormSelect(array('choices' =&gt; $choices));
        $this-&gt;validatorSchema['menu_card_id'] = new sfValidatorChoice(array('choices' =&gt; array_keys($choices)));

====================otro metodo: validar &quot;required&quot;=========================================
//el item x defecto sera en blanco (poner 'add_empty true')
//BasesDishesForm.class
'menu_card_id' =&gt; new sfWidgetFormDoctrineChoice(array('model' =&gt; 'MenuCard', 'add_empty' =&gt; true)),
//DishesForm.class
$this-&gt;validatorSchema['menu_card_id']-&gt;setOption('required', true);</pre> <a href="http://www.posteet.com/tags/doctrine">[doctrine]</a>  <a href="http://www.posteet.com/tags/formularios">[formularios]</a>  <a href="http://www.posteet.com/tags/php">[php]</a>  <a href="http://www.posteet.com/tags/symfony">[symfony]</a> ]]>        </description>
        <dc:creator>macks</dc:creator>
        <pubDate>Wed, 04 Nov 2009 21:49:17 +0100</pubDate>

            <category>doctrine</category>
            <category>formularios</category>
            <category>php</category>
            <category>symfony</category>
    
    </item>

  
    <item>
        <title>No enviar formulario con enter. Metodo 2</title>
        <link>http://www.posteet.com/view/1695</link>
        <description>
        <![CDATA[<pre>&lt;script type=&quot;text/javascript&quot;&gt;
function pulsar(e) {
  tecla = (document.all) ? e.keyCode : e.which;
  return (tecla != 13);
}
&lt;/script&gt;
&lt;!-- --&gt;
&lt;form action=&quot;loquesea.asp&quot; onkeypress = &quot;return pulsar(event)&quot;&gt;
&lt;input type=&quot;text&quot; /&gt;
&lt;input type=&quot;submit&quot; /&gt;
&lt;/form&gt;</pre> <a href="http://www.posteet.com/tags/formularios">[formularios]</a>  <a href="http://www.posteet.com/tags/javascript">[javascript]</a> ]]>        </description>
        <dc:creator>jacinmontava</dc:creator>
        <pubDate>Thu, 07 May 2009 12:41:56 +0200</pubDate>

            <category>formularios</category>
            <category>javascript</category>
    
    </item>

  
    <item>
        <title>No enviar formulario con enter. Metodo 1</title>
        <link>http://www.posteet.com/view/1694</link>
        <description>
        <![CDATA[<pre>function stopRKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) &amp;&amp; (node.type==&quot;text&quot;)) {return false;}
}
document.onkeypress = stopRKey;</pre> <a href="http://www.posteet.com/tags/formularios">[formularios]</a>  <a href="http://www.posteet.com/tags/javascript">[javascript]</a> ]]>        </description>
        <dc:creator>jacinmontava</dc:creator>
        <pubDate>Thu, 07 May 2009 12:39:52 +0200</pubDate>

            <category>formularios</category>
            <category>javascript</category>
    
    </item>

  
    <item>
        <title>Mostrar todos los elementos de un formulario</title>
        <link>http://www.posteet.com/view/1297</link>
        <description>
        <![CDATA[<pre>&lt;html&gt;
&lt;body&gt;

&lt;form id=&quot;myForm&quot;&gt;
Firstname: &lt;input id=&quot;fname&quot; type=&quot;text&quot; value=&quot;Mickey&quot; /&gt;
Lastname: &lt;input id=&quot;lname&quot; type=&quot;text&quot; value=&quot;Mouse&quot; /&gt;
&lt;input id=&quot;sub&quot; type=&quot;button&quot; value=&quot;Submit&quot; /&gt;
&lt;/form&gt;

&lt;p&gt;Get the value of all the elements in the form:&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
var x=document.getElementById(&quot;myForm&quot;);
for (var i=0;i&lt;x.length;i++)
  {
  document.write(x.elements[i].value);
  document.write(&quot;&lt;br /&gt;&quot;);
  }
&lt;/script&gt;
&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;</pre> <a href="http://www.posteet.com/tags/DOM">[DOM]</a>  <a href="http://www.posteet.com/tags/formularios">[formularios]</a>  <a href="http://www.posteet.com/tags/javascript">[javascript]</a>  <a href="http://www.posteet.com/tags/validacion">[validacion]</a> ]]>        </description>
        <dc:creator>jacinmontava</dc:creator>
        <pubDate>Thu, 02 Oct 2008 09:42:19 +0200</pubDate>

            <category>DOM</category>
            <category>formularios</category>
            <category>javascript</category>
            <category>validacion</category>
    
    </item>

  
    <item>
        <title>Enviar formulario al pulsar 'Intro'</title>
        <link>http://www.posteet.com/view/768</link>
        <description>
        <![CDATA[<pre>&lt;html&gt;
&lt;head&gt;
   &lt;title&gt;Enviar formulario al pulsar un enlace&lt;/title&gt;
&lt;script&gt;
function enviar_formulario(){
   document.formulario1.submit()
}
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;form action=&quot;pagina_destino.php&quot; method=post name=&quot;formulario1&quot;&gt;
   &lt;input name=&quot;nombre&quot; onkeypress=&quot;if (event.keyCode == 13) enviar_formulario()&quot;/&gt;
&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;</pre> <a href="http://www.posteet.com/tags/formularios">[formularios]</a>  <a href="http://www.posteet.com/tags/javascript">[javascript]</a> ]]>        </description>
        <dc:creator>jacinmontava</dc:creator>
        <pubDate>Mon, 18 Feb 2008 11:37:55 +0100</pubDate>

            <category>formularios</category>
            <category>javascript</category>
    
    </item>

  
    <item>
        <title>Enviar Form desde enlace</title>
        <link>http://www.posteet.com/view/767</link>
        <description>
        <![CDATA[<pre>&lt;html&gt;
&lt;head&gt;
   &lt;title&gt;Enviar formulario al pulsar un enlace&lt;/title&gt;
&lt;script&gt;
function enviar_formulario(){
   document.formulario1.submit()
}
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;form action=&quot;pagina_destino.php&quot; method=post name=&quot;formulario1&quot;&gt;
&lt;input type=&quot;hidden&quot; name=&quot;campo1&quot; value=&quot;valor&quot;&gt;
&lt;input type=&quot;hidden&quot; name=&quot;campo2&quot; value=&quot;otroValor&quot;&gt;
&lt;/form&gt;

&lt;a href=&quot;javascript:enviar_formulario()&quot;&gt;Enviar formulario&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</pre> <a href="http://www.posteet.com/tags/formularios">[formularios]</a>  <a href="http://www.posteet.com/tags/javascript">[javascript]</a> ]]>        </description>
        <dc:creator>jacinmontava</dc:creator>
        <pubDate>Mon, 18 Feb 2008 11:33:56 +0100</pubDate>

            <category>formularios</category>
            <category>javascript</category>
    
    </item>

  
    <item>
        <title>Comprueba que el NIF sea valido</title>
        <link>http://www.posteet.com/view/681</link>
        <description>
        <![CDATA[<pre>function nif_valido(campo)
{
abc=campo.value
nif=abc.substring(0,abc.length-1)
let=abc.charAt(abc.length-1)
if (!isNaN(let))
 {
  alert('El nif debe tener 8 digitos y una letra al final ')
  campo.focus()
  return false
 }
else
 {
  cadena=&quot;TRWAGMYFPDXBNJZSQVHLCKET&quot;
  posicion = nif % 23
  letra = cadena.substring(posicion,posicion+1)
  if (letra!=let.toUpperCase())
   {
    alert(&quot;NIF incorrecto.Revise la letra y no deje espacios. &quot;)
    campo.focus()
    return false
   }
 }

return(true)

}</pre> <a href="http://www.posteet.com/tags/formularios">[formularios]</a>  <a href="http://www.posteet.com/tags/javascript">[javascript]</a>  <a href="http://www.posteet.com/tags/validacion">[validacion]</a> ]]>        </description>
        <dc:creator>jacinmontava</dc:creator>
        <pubDate>Thu, 17 Jan 2008 14:16:03 +0100</pubDate>

            <category>formularios</category>
            <category>javascript</category>
            <category>validacion</category>
    
    </item>


</channel>
</rss>
