Hi Team,
I am new in outsystem, I have a list of products, and I have used it in a form. I need to add validation inside the input field. I have applied custom validation, but the message is not appearing. How can I fix this?"
Hi Andrew,
First you need to apply the JavaScript code I have provided below, and after that, add the attribute as shown in the image I’ve sent. Your validation will work then.
Javascript
var Permitelement = document.querySelector("div[Product_Name='" + $parameters.rownumber + "']"); if (Permitelement) { var inputField = Permitelement.querySelector("input.form-control"); if (inputField) { inputField.style.border = "1px solid red"; var errorMessage = Permitelement.querySelector(".error-message"); if (!errorMessage) { var errorDiv = document.createElement("div"); errorDiv.className = "error-message"; errorDiv.style.color = "red"; errorDiv.style.fontSize = "12px"; errorDiv.style.padding = "2px 5px"; errorDiv.style.borderRadius = "3px"; // errorDiv.innerText = "Please enter the product name"; inputField.parentElement.appendChild(errorDiv); } } }
This will help you try this
Hi Lokesh ,
I tried this but null value popup message will appear
Yes andrew It will happen because inside the javascript input parameter your value is coming null thats why it is coming can pass current row number it will work if still you are facing this issue you can share the OML I will fix this
Yes Lokesh you are right now it is working thank you so much
Hi @Andrew Botson,
Can you please share me your .OML file. It will be easier to debug the issue and give you right solution.
Thanks,
Sriyamini.J