how to change db values without a form

HI all,

I have an index page in my site and each item displayed from the model
has a link (that looks like a button)... I want that link to simply
clear a field (or set it to some value) in the underlying model for
that entry... The page does not have a form on it and i'd like to
avoid that if possible....

seems i should be able to select the link and have it process an
update on the item behind the scenes and then re-display the page (or
if i get fancier later - use ajax to red-display the item?)...

I hope this makes sense... i'm obviously new to web dev AND rails...

thanks

You're right, you don't need a form to process anything. What springs
to my mind offhand is to have the link send an AJAX request to the
server, to clear/set the field in question, and when you get back the
confirmation, show it on the screen as cleared/set. (Most likely by
getting back the data for the new value of the whole item, and
updating the item's representation on the view.)

-Dave

A simple way, avoiding AJAX and so on until you have more experience,
is to have an empty form with just the submit button. To the user it
will just look like a button but Rails will do all the clever stuff
for you. You just need to provide the action and (if appropriate)
re-display the same view.

Colin

I have an index page in my site and each item displayed from the model
has a link (that looks like a button)... I want that link to simply
clear a field (or set it to some value) in the underlying model for
that entry...

Uh, realizing that every time a spider comes along to index your site,
every one of those links will be activated? (unless the page in question
is password protected)

The page does not have a form on it and i'd like to avoid that if possible....

Google 'http idempotent request' to understand why you should use a
POST rather than GET for actions that change data.

HTH,