where i have :store => ‘btc’, :today => ‘02/25/2007’ - i need to use a
hidden field id but can’t find much on the correct syntax for this. Can
anyone help or point me to a good url?
Second i need to figure out how to loop and display only select fields
from my table instead of All the fields.
<% for entry in @entries %>
<% for column in Entry.content_columns
%>
<%=h entry.send(column.name) %>
Anyone on this? i’m sure it’s yet another newb question but i seem to be
lacking some good google skills on this one also …
where i have :store => ‘btc’, :today => ‘02/25/2007’ - i need to use a
hidden field id but can’t find much on the correct syntax for this. Can
anyone help or point me to a good url?
You should be able to use the “hidden_field” form helper
I think Luke is the winner on this one guys - I only want to throw in
the hidden value as a param but the issue is that it never seems to
work. The example you have listed above runs but does not actually throw
in the hidden date value.
This to me feels like something is not right here. I’m a .net developer
during the day and wanted to play with rails on the side (and hope to
convincee the evil M$ only dev team to start using ruby for some small
things to start, etc) - sorry this seems so hard to communicate
I use the below to manipulate the hidden value and this is why i want
the form on submit to have this as the date param
So Luke if this is the correct syntax do you know why it does not
include it in the action or onsubmit? I watch the above DOM change the
value of the hidden in firebug but don’t see any change in the form
action or onsubmit … can’t figure out why this is so hard to figure
out
On thing to note about my above post - i’m not using the
param[‘hiddendate’] in the controller as a post param (so i might have
communicated this incorrectly to Luke) but instead i need to use the
actual value stored in the hidden field (because, as you can see above,
i change this dynamically w/ some DOM(JS))
So what you’re talking about is changing the place that the form submits
whenever the hidden date field is changed?
If I’m reading that correctly, then all you should really need to do is
change your JS to be a function that does both what you are currently
doing
(set the hiddendate value) and ALSO updates that form to change where it
is
being submitted to… you could conceivably use observer_field here
(it’s a
Rails thing that allows you to make an ajax call if a field is updated)
to
observe the hiddendate field and then use AJAX to change the form’s
submit
url, but you’d be probably better off having your JS update both the
hiddendate value, and the submit string for the form… this means you
have
to hardcode in that form’s submit, OR use some further JS to take
whatever
is generated by Rails and just modify the part of the string that
contains
the date=blah part.
Luke i finally got the thing working - thanks for the help
For all those who have looked at this post and thought “this kid is
smoking crack” I have shown below what i was doing wrong (simple mistake
that i’m not to proud of)
@store = params[:store]
@today = params[:hiddendate] <!-- it was @today = params[:today] -->
i had to edit the @today in my controller - for some reason i didn’t
edit this until I noticed the reply luke put up.
on the html side i left what you had mentioned earlier
And it works like a charm - thanks to everyone for the help. Big thanks
to Luke for actually understanding my crazy request that was not
communicated well.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.