---
title: "Validators - Example 2"
canonical: "https://support.appfire.com/space/PSCONF/15305724/Validators%20-%20Example%202"
format: markdown
---
> Macro (aura-html)

> Macro (excerpt)
> 
> ```
> string errorMsg = "You must enter a comment!";
> if(!hasInput("comment")) {
>    return false, "comment", errorMsg;
> }
> ```
> 
> > ℹ️ Because the second parameter (optional) was used in this example the error message will also display beneath the comment field.
> 
> > ℹ️ When using transition screens be sure to use routines that can read screen values like [hasInput()](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15485945) or [getInput()](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15484591) otherwise the script will retrieve the value (if any) stored in the issues and not the value the user just input into the field and is trying to save.