Forum: Ruby on Rails Multi-parameter assignment in View?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ed C. (Guest)
on 2006-06-13 03:19
(Received via mailing list)
List,

I'm trying to create a composite field in my view, similar to how
datetimes are handled, but for a US 10-digit phone number.

I'd like the view to display 3 text inputs in the format ( ___ ) ___ -
____ and then concatenate the results into the Person.phone field.

Is there a way to make this automagically happen (like datimes)?

Thanks for your help,
Ed C.
Bill Walton (Guest)
on 2006-06-13 03:59
(Received via mailing list)
Hi Ed,

Ed C. wrote:

> I'm trying to create a composite field in my view, similar to how
> datetimes are handled, but for a US 10-digit phone number.
>
> I'd like the view to display 3 text inputs in the format ( ___ ) ___ -
> ____ and then concatenate the results into the Person.phone field.
>
> Is there a way to make this automagically happen (like datimes)?

Not yet.  Easy answer for today is to include all four fields in your
model,
put the three you want the user to fill-in in your view, and then do the
concantenation of those in your controller.

hth,
Bill
This topic is locked and can not be replied to.