From: José M. <jos...@se...> - 2010-06-28 11:38:26
|
Hi, There is some news about this? _____ De: José Manuel [mailto:jos...@se...] Enviado el: martes, 22 de junio de 2010 12:44 Para: htm...@li... Asunto: Re: [Htmlunit-user] Inputs out of form Hi, In web.zip you have 2 files for the page. Open on FireFox and view source code. Search 3 checkbox. When you make click on first checkbox it make changes on others checkbox by JS. You can see that there is not a form tag for that checkboxs. Web.jpg have rendered source code by IE. It make a form for that checkboxs. It put a form tag for it. _____ De: Ahmed Ashour [mailto:asa...@ya...] Enviado el: lunes, 21 de junio de 2010 13:45 Para: htm...@li... Asunto: Re: [Htmlunit-user] Inputs out of form Hi Jose, Please provide minimal and complete case (html/js/java). Yours, Ahmed ---- Blog: http://asashour.blogspot.com _____ From: Jose Manuel <jos...@se...> To: htm...@li... Sent: Sun, June 20, 2010 5:24:21 PM Subject: Re: [Htmlunit-user] Inputs out of form Hi, This JS and HTML code work on FF and IE. If you need a full source code for test it, I can send you it. -----Mensaje original----- De: Marc Guillemot [mailto:mgu...@ya...] Enviado el: sábado, 19 de junio de 2010 15:02 Para: htm...@li... Asunto: Re: [Htmlunit-user] Inputs out of form Hi José, HtmlUnit tries to parse badly formed HTML code as browsers do. In the case of forms, some of the form elements aren't children (accessible through getChildElements) but "lost children" (accessible through getLostChildren) as they aren't child elements of the form node in the DOM. This being said, in the case of your example, HtmlUnit behaves exactly like FF or IE and doesn't consider the checkbox as element of the form. Cheers, Marc. -- Blog: http://mguillem.wordpress.com José Manuel wrote: > Hi, > > In a page, it have a checkbox but it is out of form tag: > > > > <form></form><input type=checkbox name=input1 onclick=function1() /> > > > > This checkbox can to be read by document.form[0].elements[input1] on > real browsers, but HtmlUnit can not find it. > > I have listed all elements of all forms, but it dont show it. It find a > form without name and with some elements without names. > > > > ######## JAVA ############################### > > List<HtmlForm> listaFormulario = page.getForms(); > > for(HtmlForm f1:listaFormulario){ > > System.out.println("Formulario: > "+f1.getNameAttribute()); > > > > Iterable e1 = f1.getChildElements(); > > Iterator i1 = e1.iterator(); > > while(i1.hasNext()){ > > System.out.println("Elemento: "+ > ((HtmlElement)i1.next()).getAttribute("name")); > > } > > } > > > > ############ JS ############################### > > function marcarDesmarcarTodasCuentas() { > > > > var checked = document.forms[0].todasCuentas.checked; > > > > for (i=0; i < num_cue; i++) { > > > > document.forms[0].elements["pro_ori_" + i].checked = checked; > > > > } > > > > } > > > > ########### HTML ############################## > > <table class="tblexterior" border="0" cellspacing="0" width="100%"> > > <tbody> > > <tr class="trcabprin"> > > <form></form> > > <td class="tdrestitver" align="center" bgcolor="#9cd1e7"> > > <input name="todasCuentas" onclick="marcarDesmarcarTodasCuentas()" type="checkbox"></td> > > <td class="tdrestitver" align="left"> Número</td> > > <td class="tdrestitver" align="left"> Descripción</td> > > <td class="tdrestitver" align="center" bgcolor="#9cd1e7">Saldo</td></tr> > > <tr> > > <td width="2%"><input name="pro_ori_0" type="checkbox"></td> > > <td class="tddattithor" width="29%"> </td> > > <td class="tdresizq" width="39%"> </td> > > <td class="tdresdcha" width="28%">  </td></tr> > > <tr> > > <td width="2%"><input name="pro_ori_1" type="checkbox"></td> > > <td class="tddattithor" width="29%"> </td> > > <td class="tdresizq" width="39%"> </td> > > <td class="tdresdcha" width="28%">  </td> > > </tr> > > </tbody> > > </table> > > Se certificó que el correo entrante no contiene virus. Comprobada por AVG - www.avg.es Versión: 8.5.439 / Base de datos de virus: 271.1.1/2955 - Fecha de la versión: 06/22/10 06:36:00 Se certificó que el correo entrante no contiene virus. Comprobada por AVG - www.avg.es Versión: 8.5.439 / Base de datos de virus: 271.1.1/2968 - Fecha de la versión: 06/28/10 06:37:00 |