[Bug] add required to input field does not work
Hi,
if I add required="true" to my input field it does not work.
I thought the following input should be validated correct (after #11).
Unfortunately it does not work:
working:
<Label text="Old style" required="true" />
<Input value="{
path : '/text',
type : 'sap.ui.model.type.String',
constraints : {
minLength : 3,
maxLength : 10
}
}"
/>
not working:
<Label text="length and required" required="true" />
<Input value="{
path : '/text2',
type : 'sap.ui.model.type.String',
constraints : {
minLength : 3,
maxLength : 10
}
}"
required="true" />
<Label text="only required" required="true" />
<Input value="{
path : '/text3'
}"
required="true" />

see http://plnkr.co/edit/nj3kFKSFjtkZElQMi69m?p=preview
Any suggestions?
Thanks
Hi,
SAPUI5 framework retains the previous ValueStateText message after repeated validations. Solution would be to clear ValueStateText along with setting value state to None.
But it seems you use the old version of code and this suggestion is not valid for you.
Please check this example, where I used latest code base with my corrections: http://plnkr.co/edit/5Wxy5wzv11sGj3UQ?preview
Regards, Vladimirs
Hi,
SAPUI5 framework retains the previous ValueStateText message after repeated validations. Solution would be to clear ValueStateText along with setting value state to None.
But it seems you use the old version of code and this suggestion is not valid for you.
Please check this example, where I used latest code base with my corrections: http://plnkr.co/edit/5Wxy5wzv11sGj3UQ?preview
Regards, Vladimirs
Hi @vpasedko,
I don't know if we talked of the same issue, but I confronted a bug too with the required attribute. If I don't set required to true but I add a regex contraint in search, the validation error occurs anyway.
Here is what I tested in your example code (constraint is AAA + 3 digits but field not required ):
<Label text="Name" /> <Input value="{ path : '/userName', type : 'sap.ui.model.type.String', constraints : { minLength : 0, maxLength : 10, search: 'AAA[0-9]{3,}' } }"/>
Hi, SAPUI5 framework retains the previous ValueStateText message after repeated validations. Solution would be to clear ValueStateText along with setting value state to None. But it seems you use the old version of code and this suggestion is not valid for you. Please check this example, where I used latest code base with my corrections: http://plnkr.co/edit/5Wxy5wzv11sGj3UQ?preview Regards, Vladimirs
Hi @vpasedko,
I don't know if we talked of the same issue, but I confronted a bug too with the required attribute. If I don't set required to true but I add a regex contraint in search, the validation error occurs anyway.
Here is what I tested in your example code (constraint is AAA + 3 digits but field not required ):
<Label text="Name" /> <Input value="{ path : '/userName', type : 'sap.ui.model.type.String', constraints : { minLength : 0, maxLength : 10, search: 'AAA[0-9]{3,}' } }"/>
Hi,
Required field validation is an extra validation before constraints check. Validator executes constraint conditions check all the time despite "required" property set or not set. You need to adjust a regex string to something like 'AAA[0-9]{3,}|^$' to accept empty strings where tokens "|^$" allow empty strings.
Regards, Vladimirs