cancel
Showing results for 
Search instead for 
Did you mean: 

Input field or text field validation in SAPUI5 using XML view

arindam_samanta
Participant
0 Kudos

Hi Experts,

I need to validate the input fields in SAPUI5. I know the JavaScript view. but I need to validate the input fields using XML code. I need to write the code in view.xml file using XML code. If any error occur, the input field become red color bordered.

Any possible solution would be accepted gratefully.

Thanks & Regards,

Arindam Samanta.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Arindam,

You cannot define any functions in XML Views. The editor itself provides a controller.js file whenever you try to create a view, whether it is XML, JavaScript or HTML view, because here the logic can be implemented in JS files only.

You can a call specific function defined in your controller.js to your XML Views, Example already shared by Angel Puertas.

Regards,

Sharique

arindam_samanta
Participant
0 Kudos

Hi Sharique,

I know that. I wanted to know the the XML view code for the input field. Validation can be achieved through java script only. We have that code. We are looking for XML code for the input fields.

Kindly provide the XML code for the input fields.

Thanks & Regards,

Arindam Samanta.

Former Member
0 Kudos

Hi Arindam,

I have given one solution in your another post having the same question.

There you mentioned about about Date inputs that's why i have given DateTimeInput, if you want to use TextFields then you can replace it with Input.

Regards,

Sharique

arindam_samanta
Participant
0 Kudos

Thank you for  your reply... I got the XML code sample and trying to create my view using XML code. But I am now trying to learn JavaScript for controller.

santhu_gowdaz
Active Contributor
0 Kudos

Please close the thread with correct and helpful answer. It will be helpful to me and others,who are looking the solution for the same problem.

former_member182650
Contributor
0 Kudos

Hi Arindam,

Try this:

<TextField liveChange="validateFunction"/>


And create validateFunction on your controller.

Kind regards