joergrech / KickstartWithBootstrap

Kickstart is an extension for Grails in order to start your project with a good looking frontend. It is intended to be used in rapid application scenarios such as a Startup Weekend or a prototyping session with a customer. This plugin provides adapted scaffolding templates for standard CRUD pages using Twitter's CSS Framework Bootstrap and offers some basic pages for a web site.
65 stars 52 forks source link

Type of g:field tag #82

Open claudiogg88 opened 10 years ago

claudiogg88 commented 10 years ago

i'm have a field in my domain class with double type, when I run generate-all in my domain class the _form template generated have a g:field tag in this field without "type" attributte

Domain class: Double importe _form.gsp : <g:field class="form-control" name="importe" value="${fieldValue(bean: facturaItemInstance, field: 'importe')}" required="" />

magicboo commented 10 years ago

Maybe it should be type="number" and add step="any" to allow chrome to input float numbers. Ref: http://stackoverflow.com/questions/8052962/groovy-grails-float-value-and-html5-number-input

claudiogg88 commented 10 years ago

works, thanks :)

magicboo commented 10 years ago

Do you have Date fields?

My date field in _form.gsp like <bs:datePicker name="tradeDate" precision="day" value="${itemStatusInstance?.tradeDate}" /> always complain "Property tradeDate must be a valid Date" and I don't know why?

The date format is (yyyy-MM-dd) by default.

claudiogg88 commented 10 years ago

yeap, I have the same problem, maybe must edit/fix the file src/scaffolding/renderEditor.template ???

magicboo commented 10 years ago

But I still didn't find the solution. Do you? Or should we change to not using bs:datePicker?

claudiogg88 commented 10 years ago

nop, not yet.

pbb6w7 commented 10 years ago

I have not tried to use the date feature but I found that both editor template and the _form.gsp in /src/scaffolding have issues - one of the issues I have been dealing with is the implicid unique equal true (default) - to my recollection the _form.gsp made a code change to figure out the reqiured attribute but it seemed it did not work right. Could this be the problem for you? (Also see issue #80 for the renderEditor.template - similar issues were found) Hope this helps.

magicboo commented 10 years ago

<bs:datePicker name="tradeDate" precision="day" value="${itemStatusInstance?.tradeDate}" /> is rendering to <input id="tradeDate" name="tradeDate" class="datepicker null" size="16" type="text" value="2014-04-11" data-date-format="yyyy-mm-dd"/> and I can't find the point that grails do the validation (because I didn't add any constrain)

I found a solution to add b>@BindingFormat('yyyy-MM-dd')</b before my date field in domain class solve the date binding issue. (http://www.jellyfishtechnologies.com/binding-date-in-grails-using-bindingformat/)

But, is this the best (or suggested) way to bind the date field in grails 2.3.x?

claudiogg88 commented 10 years ago

renderEditor.template is wrong, I fixed http://pastebin.com/tZP7ec6H