when grails creates view, it automatically adds a maxLength attribute to text fields. This is great because users will not be able to input a string which is longer than the contraint. This helps to avoid getting an error message...
however, if you try the same with a textarea, grails will not place such a contraint in the html code. I know: html has no maxLength for textareas. But there are many javascript based solutions out there which even show how many characters are left...
Does anybody know of a plugin which adds this feature?
PS: I am speaking of Grails 1.3.7 - don't know if a newer version already implements this.
I don't know of a Grails plugin that does this. There are many JQuery plugins that provide this feature, but if you use one of those you'll need to devise some mechanism for keeping the domain constraints in synch with the JavaScript (or do it manually).
Related
I am using Orbeon 2016.1 to develop forms in English and Welsh. However, the only way I can see to translate the default validation message, "Missing or incorrect data" is to untick the default message and paste in the translated version.
There is some xpath in one of the Formula which is preventing me from saving any changes, which means I will need to add an <alert/> node for each control in the resources instance.
If there is a property to configure a default localised validation message? This would save lots of time going through a large form!
Thanks in advance,
You can override built-in Form Runner resource using properties, and this for all your forms, or just certain forms. For more on this, see the section Overriding resources in the documentation.
Using Grails 2.3.5 and try to make a dynamic form like described in link below:
http://omarello.com/2010/08/grails-one-to-many-dynamic-forms/
But when access the create, none phone field are shown.
I've copied exactly like the example. I don't know if there are some kind of conflicts with the javascript or something else.
I was wondering how one would apply a global stylesheet to their entire site? I want to add twitter bootstrap, and a select number of other global styles, so that all the visuals are consistent.
Would I add a <link> to the layouts/main.gsp file?
UPDATE
Seems it's the css/main.css file that I'm interested in. Along with the layouts/main.gsp's reference to it. Could someone confirm this?
By default grails will use the "main" layout for scaffolding. So yes, those are the two files you are interested in.
I inherited the management of a Symfony site and need to add some HTMl form tags to one of the "static" pages via the CMS. The scenario I have is:
/index.php/splash/welcome pulls up the welcome screen.
We want to be able to add a subscription button on that page.
The HTML has been supplied for us by the company that handles the subscriptions.
The form post method has an action that references a script on a remote site (no lectures on the security implications please ;-).
When I add the <form... and <input... tags via the CMS admin panel, the tags get removed automatically by Symfony.
Is there a way to tell Symfony to allow these tags?
Thanks in advance,
Marty.
This is goign to depend completely on how the developer set up the CMS. Youre using a rich text editor in source mode i would take a look at that editor's config file and documentation because its probably the one responsible for stripping the tags.
If its just a plain text area i would check the submit action for the edit form and take a look at the code... he may be using something to strip them in there.
If youre using one of the Symfony CMS plugins (Diem, Apostrophe, Sympal) i might be able to help further if i know which one youre using. If its something custom we would need to see the code. This isnt really indiciative of the Symfony core, but rather the CMS youre using.
How do you (if you) manage client side validation with grails ? Do you use a plugin or do you mirror your constraints using a javascript framework ?
Cheers
I haven't used them personally but these two plugins might help you out:
http://grails.org/plugin/javascript-validator
http://www.grails.org/plugin/remote-constraints
On Grails projects that I've been a part of, We haven't used a plugin but rather a mashup of javascript plugins and custom validators (jQuery plugins, Prototype, Dojo, etc.) to achieve the client side validation. Its handy to provide instant field-level validation on the client.
As leebutts said, The source of these plugins are open. Why not consider enhancing one(or both) of these plugins to achieve what you need and contribute that back to the community?
Might be worth checking out the new constraints plugin. With it Constraints become a Grails artefact, and might make this job easier.