[HtmlUnit] [htmlunit:bugs] #1992 Error in validation of required fields

RBRi via HtmlUnit-develop <[email protected]> Tue, 30 Oct 2018 19:32:51 -0000
Newsgroups gmane.comp.java.htmlunit.devel
Message-ID </p/htmlunit/bugs/1992/1391fb3a863261a43458eaaa48e20a7c36b81aa9.bugs@htmlunit.p.sourceforge.net>
Finally found the time to add the info log output.


---

** [bugs:#1992]  Error in validation of required fields**

**Status:** pending
**Group:** 2.33
**Created:** Wed Oct 10, 2018 03:00 PM UTC by Leonardo Silva Medina
**Last Updated:** Thu Oct 11, 2018 02:15 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