Calender Control

I want to use the calender control in my application like what i added
in the attachment file for, from date and to date it should display
records but i unable to attach it in ruby on rails application well its
working fine in Dot Net too…
I want to show the records between first and the second textbox field
date entries i am going to use the code

@date1=params[:date1]
@date2=params[:date2]

@date2ss = Date2.find(:all, :conditions => “ID > '”+ @date1 +"’ and ID
<’"+ @date2+"’")

Problems
1>how i validate the calender date fields in the text boxes?
2>how i use the calender control in ruby on rails application?
(…so that on click of that control it display the calender and on
selecting the date should be display in the respected text box…)
thanks in advance,
vaibhavi