Note that there are some explanatory texts on larger screens.

plurals
  1. POgrails controllers errors
    primarykey
    data
    text
    <p>I have this DomainClass:</p> <pre><code>package cm class XXX{ String city String website static constraints = { city(nullable: true) website(nullable: true) } static mapping = { id column:'xxx_id' city column: 'xxx_city' website column: 'xxx_website' table "xxx_XXX" version false } } </code></pre> <p>The Controller:</p> <pre><code>class ConferenceController { static allowedMethods = [save: "POST", update: "POST", delete: "POST"] def index = { redirect(action: "list", params: params) } def list = { params.max = Math.min(params.max ? params.int('max') : 10, 100) [XXXInstanceList: XXX.list(params), XXXInstanceTotal: XXX.count()] } def save = { def XXXInstance= new XXX(params) if (!XXXInstance.save(flush: true)) { render view: 'add', model: [XXXInstance: XXXInstance] return } //flash.message = "${message(code: 'default.created.message', args: [message(code: 'person.label', default: 'Person'), personInstance.id])}" redirect(uri:"/index.gsp") } } </code></pre> <p>and my add.gsp page:</p> <pre><code>&lt;head&gt; &lt;title&gt; xXXx&lt;/title&gt; &lt;meta name="layout" content="main2" /&gt; &lt;/head&gt; ... &lt;g:form controller="XXX" action="save"&gt; &lt;g:hasErrors bean="${XXXInstance}"&gt; &lt;div class="errors"&gt; &lt;g:renderErrors bean="${XXXInstance}" as="list" /&gt; &lt;/div&gt; &lt;/g:hasErrors&gt; year &lt;g:textField name="year" /&gt;&lt;br&gt; website &lt;g:textField name="website" /&gt;&lt;br&gt; &lt;g:submitButton name="save2" value="Save" /&gt; &lt;/g:form&gt;&lt;/div&gt; &lt;/div&gt; ... &lt;/body&gt; </code></pre> <p>With this current code, everything works fine, but when a contraint is failed, it is showns the corresponding error but the written values are gone.. I cant figure this out - i'v tried a lot of things, but im sure the solution is as easy as my question -.- Please help.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload