Update the form


#1

Hi

im using five forms(5 pages) and one controller.select the edit form1
page
values displayed but i change values after updated but not change the
values
in database .only already values stored.

view code
-----------------------------------------------------------------------------------editresortadditionaldetails.html

<% form_tag :action => ‘update’,:controller=>‘Wizard’,:id=>@id do %>



Edit Resort Additional Detail


























Amenities

<%=text_area_tag
@resort_additionaldetail.aminity,@resort_additionaldetail.aminity%>

Directions
        <%=text_field_tag

@resort_additionaldetail.directions,@resort_additionaldetail.directions
%>


Transport

<%=text_field_tag
@resort_additionaldetail.transport,@resort_additionaldetail.transport %>

Map
        <%=text_field_tag

@resort_additionaldetail.map,@resort_additionaldetail.map %>


Pickup Offered

<%=text_field_tag
@resort_additionaldetail.pickupoffered,@resort_additionaldetail.pickupoffered
%>

Email
       <%=text_field_tag

@resort_additionaldetail.email_id,@resort_additionaldetail.email_id %>

<%=submit_tag "Update" ,:class =>'myButton' %>
   </td>

</tr>

<% end %>

controller code

def editresortbasics

render :text =>params[:resortname]

@resort_basic.resortname=params[:resortname]

 # logger.debug(params[:id])

session[:editresort_id]=params[:id]
@id = session[:editresort_id]
@resort_basic =ResortBasic.find(@id)

#if request.post?

@resort_basic.update_attributes(params[:resort_basic])

flash[:notice] = ‘Resort was successfully updated.’

redirect_to :action => ‘editresortbasic’,

session[:resort_basic]=@resort_basic

session[:editresort_id]=params[:id]

render :action=> “editresortbasic”

redirect_to(@resort_contactdetail)

end

def editresortcontacts

@id = session[:editresort_id]
#render :text =>@id
@resort_contactdetail =ResortContactdetail.find(@id)
session[:resort_contact]=@resort_contactdetail
render :action => “editresortcontact”
end

def editresortaddresses
@id = session[:editresort_id]
@resort_address =ResortAddress.find(@id)

session[:resort_address]= @resort_address

render :action => “editresortaddress”
end
def editresortaccomodations
@id = session[:editresort_id]
@resort_accomodation =ResortAccomodation.find(@id)
session[:resort_accomodation]= @resort_accomodation
render :action => “editresortaccomodation”
end
def editresortadditional
@id = session[:editresort_id]
@resort_additionaldetail =ResortAdditionaldetail.find(@id)
render :action => “editresortadditionals”
end

def update

@resort_basic =ResortBasic.find(params[:id])

@resort_basic = session[:resort_basic]

@resort_basic.update_attributes(params[:resort_basic])

#@resort_contactdetail =ResortContactdetail.find(params[:id])

@resort_address =ResortAddress.find(params[:id])

@resort_accomodation =ResortAccomodation.find(params[:id])

@resort_additionaldetail =ResortAdditionaldetail.find(params[:id])

render:text=>params[:id]

#if request.post?

@resort_contactdetail = session[:resort_contact]

#@resort_contactdetail.update_attributes(params[:resort_contact])

@resort_address = session[:resort_address]

@resort_address.update_attributes(params[:resort_address])

@resort_accomodation = session[:resort_accomodation]

@resort_accomodation.update_attributes(params[:resort_accomodation])

if
@resort_additionaldetail.update_attributes(params[:resort_additional])
# render:text=>params[:resort_additional]

flash[:notice] = ‘Add Resort was successfully updated.’

render :action => “resortupdated”
#redirect_to(@resort_additionaldetail)
end

Values not updated in database.give idea and any one help for me

Thanks
Balaji


#2

Hi
im using five forms(5 pages) and one controller.select the
edit
form1 page values displayed but i change values after updated but not
change
the values in database .only already values
stored.

any one help for me

Thanks
balaji

On Thu, Dec 18, 2008 at 3:46 PM, balaji rajagopal <