Multi-parameter assignment


#1

Hi,

I’m trying to submit data from text boxes on a form to one variable in
my controller, in the same way that datetime_select has date(1i),
date(2i), etc for day, month, year, etc…

I’ve named my variables event[start_date(1i)] event[start_date(2i)] and
event[start_date(3i)] but this doesn’t seem to work and
event[:start_date] is blank … any pointers would be useful! Can’t
seem to find any docs for this!

Cheers,
Mark


#2

Mark P. wrote:

Hi,

I’m trying to submit data from text boxes on a form to one variable in
my controller, in the same way that datetime_select has date(1i),
date(2i), etc for day, month, year, etc…

I’ve named my variables event[start_date(1i)] event[start_date(2i)] and
event[start_date(3i)] but this doesn’t seem to work and
event[:start_date] is blank … any pointers would be useful! Can’t
seem to find any docs for this!

Cheers,
Mark

Can you post a code snippet?


#3

Arch S. wrote:

Mark P. wrote:

Hi,

I’m trying to submit data from text boxes on a form to one variable in
my controller, in the same way that datetime_select has date(1i),
date(2i), etc for day, month, year, etc…

I’ve named my variables event[start_date(1i)] event[start_date(2i)] and
event[start_date(3i)] but this doesn’t seem to work and
event[:start_date] is blank … any pointers would be useful! Can’t
seem to find any docs for this!

Cheers,
Mark

Can you post a code snippet?

I’ve had a play around, so I’ll try and explain properly:

On my form I have:


I intend for this to end up in my controller as:
eventdetail[:start_time] = “15/04/2006” + " " + “21:46”
Which can then be validated on save.

It doesn’t seem to work that way, as start_time is not assigned after
the form is submitted but only when I do:
@eventdetail = Eventdetail.new(@params[:eventdetail])

Which gives me an error:
1 error(s) on assignment of multiparameter attributes

I understand this would be trying to do Date.new(“15/04/2006”, " ",
“21:46”) which is wrong, so the real question is, is it possible to
automatically get start_time to just end up as the one string I can work
with?

Cheers,
Mark