I am new to Grails and would like to know how I can set the required field check on gsp or the Grails controller. For example: if the user does not enter his username, I must request a message
Username required.
Where to begin?
This guide discusses the user guide in detail. Seehttp://docs.grails.org/latest/guide/validation.html
Search for Command objects: http://www.grails.org/Command+objects+and+Form+Validation
class MyController { def myAction = { MyCommand cmd -> if (cmd.hasErrors()) { // do fail things } else { // do success things } } } class MyCommand { String username static constraints = { username(nullable:false, blank:false, minSize:4) } }
GSP. :
<g:textField name="username" required="true" value="${user?.login}"></g:textField>
required = true , - .
Source: https://habr.com/ru/post/1762698/More articles:a problem with IE that removes newlines from $ ("# content"). text () - javascriptEF 4.0 - Download the navigation property of the navigation property - c #Почему у моих маршрутов Rails 2 есть строки запросов? - query-stringsvn add iphone4 icon - svnDo crawlers decode html objects? - htmlHow to find the number of multipliers from 3 - cJQuery and Rails 3 ajax: failure callback - jqueryHow to repeat with Pisa (xhtml2pdf) - htmlhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1762702/best-way-to-merge-a-git-revision-into-a-mercurial-repository&usg=ALkJrhiaRzT45aYV1Cnv4ZN_vWivpsSxvwHow can I use multiple views in Zend_Application (using Zend_Layout)? - phpAll Articles