I am very loosely validating a set of fields in a multistage form trying to make sure key fields have some data in them before continuing. I have the following validation function created. Very simple as I want to get this working before I start validating the data itself as well.
function validateCustTab(){
Session.set("custTabErrorMsg", "");
Session.set("custTabError", false);
if($('input:text[name=customerSearch]').val() === "")
{
Session.set("custTabErrorMsg", Session.get("custTabErrorMsg") + "<div class='row'>* Require a Customer To Proceed </div>");
Session.set("custTabError", true);
}
if($('input:text[name=orderLoadNum]').val() === ""){
Session.set("custTabErrorMsg", Session.get("custTabErrorMsg") +"<div class='row'>* Require a Unique Load Number To Proceed </div>");
Session.set("custTabError", true);
}
if($('input:text[name=orderPlacedDate]').val() === ""){
Session.set("custTabErrorMsg", Session.get("custTabErrorMsg") +"<div class='row'>* Require an Order Entry Date To Proceed </div>");
Session.set("custTabError", true);
}
if($('input:text[name=orderCharges]').val() === ""){
Session.set("custTabErrorMsg", Session.get("custTabErrorMsg") +"<div class='row'>* Require Order Charges To Proceed </div>");
Session.set("custTabError", true);
}
if(Session.get("custTabError")){
Modal.show('orderEntryCustTabErrorModal');
console.log("Not Valid");
return false;
}else{
console.log("Valid");
return true;
}
}
The function that calls this looks for a true false and either shows the next stage or shows a modal with the error messages. Now what is happening is that this all works correctly except that the info displayed in the modal is an exact diplicate of the string in the session variable. The html is not getting parsed out. I have tried a few different combinations. Instead of div rows I just had
tages. I also tried without html and used the \n but that never worked either.
Picture of what I am seeing.
What I am looking for is how do I display this in the modal as a multiline error message? I must be missing something small here.
You need to use three curly braces to escape the HTML tags