[HtmlUnit] [htmlunit:bugs] #1992 Error in validation of required fields
RBRi via HtmlUnit-develop <[email protected]> Wed, 10 Oct 2018 17:44:54 -0000
| Newsgroups | gmane.comp.java.htmlunit.devel |
|---|---|
| Message-ID | </p/htmlunit/bugs/1992/b7853fa052162cbfd11aea9b8432b0ea61d0bbd1.bugs@htmlunit.p.sourceforge.net> |
- **status**: open --> accepted
- **Comment**:
Have added some tests but can't see a case where this works different from the browsers.
Please have a look...
https://github.com/HtmlUnit/htmlunit/commit/1d1b007e1a55dfd2c3cbd5db47a6af3d71d88dbb
---
** [bugs:#1992] Error in validation of required fields**
**Status:** accepted
**Group:** 2.33
**Created:** Wed Oct 10, 2018 03:00 PM UTC by Leonardo Silva Medina
**Last Updated:** Wed Oct 10, 2018 03:00 PM UTC
**Owner:** RBRi
Hi !!
I try to perform a test on a form and when clicking I do not do any event, the form has an elment of
<input type="text" id="idUserRecupera" class="autoMayuscula sinTildes" autocomplete="off" required="">
to appear in the class
/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java => method
public boolean isValid() {
return !isRequiredSupported() || getAttributeDirect("required") == ATTRIBUTE_NOT_DEFINED
|| !getAttributeDirect("value").isEmpty();
}
there is a method that validates the required fields, and I note that it has three validation criteria with a conditional || ( OR ), following the code for my case the condition (getAttributeDirect ("required") == ATTRIBUTE_NOT_DEFINED) this returns as FALSE result, but observed in more detail I see that it should be true since,
getAttributeDirect ("required") = ""
ATTRIBUTE_NOT_DEFINED = "",
change it to
getAttributeDirect ("required"). equals (ATTRIBUTE_NOT_DEFINED)
and return the result that should be TRUE, in my opinion it is the indicated comparison to determine if the values are the same.
public boolean isValid() {
return !isRequiredSupported() || getAttributeDirect ("required"). equals (ATTRIBUTE_NOT_DEFINED)
|| !getAttributeDirect("value").isEmpty();
}
---
Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/htmlunit/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
_______________________________________________
HtmlUnit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop