Bring value from one webpage to another webpage in Ruby on Rails website
without database
Summary
I'm trying to bring a value from one webpage to another webpage on my Ruby
on Rails site without saving it a second time into my MySQL database. I'm
new to Ruby, so thanks in advance for your patience.
Overview
My website users can save a map they have created. Now, I want them to be
able to edit the maps.
I have a webpage, newmaps.html.erb, that renders the map. The map has a
unique ID:
<%= newsavedmap.id %>
There's an "Edit" button under the map. When the user clicks "edit", I
want him to be taken to another webpage, maptry.html.erb , which is
essentially a form that lets the user edit the map.
Problem
I want that specific newsavedmap.id to transfer over to maptry.html.erb so
that I can load the form with newsavedmap.startingaddress,
newsavedmap.endingaddress, and all of the other data associated with that
record.
I think I'm supposed to use "POST", but I'm not sure how to do that in
this situation. This link has given me some ideas, but my form is not a
Rails form so I'm not sure how to translate it into my own solution: Pass
a custom _form text field parameter to a second page Rails
maptry.html.erb
<div id="control_panel">
<div>
<input id="startingaddress" type="text" name="starthere" size="56"></p>
</div>
<div>
<input id="endingaddress" type="text" name="endhere" size="56"></p>
</div>
<div>
<input onclick="calcRoute();" id="showmapview" value="Show Map">
</div>
</div>
No comments:
Post a Comment