Use regex to do validation in g:TextField

不羁岁月 提交于 2019-12-06 03:00:49

So I was able to figure out the correct regex. The issue that I was having was about the escape characters and the way they were being interoperated.

<g:textField type="number" pattern="^[0-9]+\\s*\$|^[0-9]+\\.?[0-9]+\\s*\$" required="true" class="form-control" name="hours" value="${deliverable.estimatedHours}"/>

This will now check the format for an input string and make sure that it only contains numbers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!