Changing the default validation field names displayed in errors...

27 views
Skip to first unread message

Matt S.

unread,
May 21, 2013, 1:53:02 PM5/21/13
to fubumv...@googlegroups.com
Is it possible to change how the validation errors display field names by default? For example, now a required field error message displays, "FirstName - This field is required." My form label automatically breaks apart the camel casing of my property, so "FirstName" displays on the form as "First Name".

Can I swap out the default field name resolution that all validators use by default to use the same logic and match my form labels?

Joshua Arnold

unread,
May 21, 2013, 2:08:51 PM5/21/13
to fubumv...@googlegroups.com
Dang it, Matt. I just found a "TODO" that I was really hoping had been handled, sorry.


The easiest thing to do would be to modify the existing LocalizationAnnotationStrategy to smuggle the localized label down as a  data attribute. Then change that TODO to just pull it from the message's element.

This is taken care of on the server-side but the clientside build up is definitely missing it. Can you make an issue in the validation repo? I can take this one pretty fast later tonight.




On Tue, May 21, 2013 at 12:53 PM, Matt S. <ven...@gmail.com> wrote:
Is it possible to change how the validation errors display field names by default? For example, now a required field error message displays, "FirstName - This field is required." My form label automatically breaks apart the camel casing of my property, so "FirstName" displays on the form as "First Name".

Can I swap out the default field name resolution that all validators use by default to use the same logic and match my form labels?

--
You received this message because you are subscribed to the Google Groups "FubuMVC Development Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fubumvc-deve...@googlegroups.com.
To post to this group, send email to fubumv...@googlegroups.com.
Visit this group at http://groups.google.com/group/fubumvc-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Matt S.

unread,
May 21, 2013, 2:51:43 PM5/21/13
to fubumv...@googlegroups.com
I'm a troublemaker this week! :-) I'll post the issue now.

BTW, I'm updating my solution to use ripple 2 today, so I can get at all these new changes. I must say, it is giving me a sense of freedom from the whole mismatched versioning among my projects. Not to mention, it is just easier to get the latest bits from Fubu edge with ripple over standard NuGet. Kudos again to you guys for all this new awesomeness!

jmarnold

unread,
May 22, 2013, 1:30:55 AM5/22/13
to fubumv...@googlegroups.com
Pushed the fix just now. ripple restore --force and you'll have it unless you're a night owl like me and try it before TC finishes building ;).

Matt Sollars

unread,
May 22, 2013, 11:09:20 AM5/22/13
to fubumv...@googlegroups.com
That was fast. I'm a night owl, but on the east coast, so that would've been a bit late even for me. :-)

Okay, I pulled in the latest bits and see some changes. My client-side errors are now showing: "en-US_FirstName - Required Field", etc. Admittedly, I've not been using localization to this point. I've just been relying on my form labels being broken apart on camel-casing. I messed around with the HeaderTextAttribute after seeing that change in your latest commit, but I guess I'm clueless.

That said, is there a link you can point me to that will get me started on setting this up to work? Also, is there a global way I can tell Fubu, "When there is no localized information for something, default to breaking up the camel-caes property name."?




On Wed, May 22, 2013 at 1:30 AM, jmarnold <rncod...@gmail.com> wrote:
Pushed the fix just now. ripple restore --force and you'll have it unless you're a night owl like me and try it before TC finishes building ;).

--
You received this message because you are subscribed to a topic in the Google Groups "FubuMVC Development Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fubumvc-devel/HKBNvoexRD4/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to fubumvc-deve...@googlegroups.com.

Joshua Arnold

unread,
May 22, 2013, 11:32:02 AM5/22/13
to fubumv...@googlegroups.com
"When there is no localized information for something, default to breaking up the camel-case property property name"

ripple install FubuMVC.Localization ;)



--
You received this message because you are subscribed to the Google Groups "FubuMVC Development Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fubumvc-deve...@googlegroups.com.

Matt Sollars

unread,
May 22, 2013, 3:49:52 PM5/22/13
to fubumv...@googlegroups.com
Gee, that was easy. FYI, I did have to add the following line in my FubuRegistry to get it jump-started.

Import<BasicLocalizationSupport>();

Joshua Arnold

unread,
May 22, 2013, 4:43:27 PM5/22/13
to fubumv...@googlegroups.com
Can you do me a favor and add an issue for that? I keep forgetting to look into it.

Matt Sollars

unread,
May 22, 2013, 5:29:40 PM5/22/13
to fubumv...@googlegroups.com
You got it! Done.

Works beautifully, btw.

Joshua Arnold

unread,
May 28, 2013, 12:57:17 AM5/28/13
to fubumv...@googlegroups.com
Pointing you at localization made me want to doc it. So here you go, sir:

Matt Sollars

unread,
May 28, 2013, 10:03:38 AM5/28/13
to fubumv...@googlegroups.com
Oh, man. This is nice! Thank you very much.


On Tue, May 28, 2013 at 12:57 AM, Joshua Arnold <rncod...@gmail.com> wrote:
Pointing you at localization made me want to doc it. So here you go, sir:

--
Reply all
Reply to author
Forward
0 new messages