In my booking/_form.rhtml, I have 2
startingdate (selction from unobstrusive calendar ) and endingdate
<%= text_field_tag('startdate', @startdate, {:class => @startdateclass, :readonly => "readonly", :maxlength => "25"} )%> <%= observe_field("startdate", :frequency => 0.5, :url => {:controller => 'booking' , :action => 'startdateChanged' }, :update => 'enddate', :with => "'input='+$('startdate').value ")%>
<%= text_field_tag('enddate', @enddate, {:class => @enddateclass, :readonly => "readonly", :maxlength => "25"} ) %>
in my controller when a new startingdate is selected, I modify the
endingdate field value (+10 days) but I should also modify the css
clas that will toggle some dates in the calendar ( a format with
rangelow…) but I don’t know how to modify the css class string of
the ending date
the value is correctly set, not the css class when rendering the
page…
def startdateChanged
pd = ParseDate::parsedate(@params[“input”])
tl = Time.local(pd[0], pd[1], pd[2])
@enddate = (tl+(8460010)).strftime("%d/%m/%Y")
render :update do | page |
page[‘enddate’].value = @enddate
@enddateclass = “format-d-m-y range-low-” + (tl
+(8460010)).strftime("%d-%m-%Y")
end
end
thanks for your tricks
kad