Zend_Rest_Route has built-in support for a couple of special routes that are
related to forms - edit and new.

/product/rating/new

will route to Product_RatingController::newAction() which you could
implement simply:

public function newAction(){}

In accordance with RESTful principles, this will do nothing on the
server-side state. It's simply a request for a form to create a new rating
resource. Just make a rating/new.phtml template like so:

<form method="post" action="/product/rating">
...
</form>

in the module script dir.

Similarly,

/product/rating/{id}/edit

will route to Product_RatingController::editAction($id) which you could
implement simply as:

public function editAction($id)
  { $this->view->resource = $this->getAction($id); }

And then create a rating/edit.phtml template with a form like so:

<form method="put" action="/product/rating/{$this->resource->id}">

or:

<form method="post" action="/product/rating/{$this->resource->id}">
<input type="hidden" name="_method" value="put"/>

-L
-- 
View this message in context: 
http://n4.nabble.com/Zend-Rest-fetch-forms-via-AJAX-tp1559161p1560659.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to