schema.yml:
Shop:
title: { type: string(50) }
number: { type: integer(2) }
i can set default value for number in ShopForm.class or method save. but how can i make it with address URL?
http://www.myaddress.com/shop/new
in action.class.php (Shop.class.php)
public function executeNew(sfWebRequest $request)
{
$this->form = new ShopForm();
}
for example if i open address:
http://www.myaddress.com/shop/new/number/2
then automatically set number = 2 for this form.
thanks for help!
you can catch the parameter in the New Action doing this:
Doing that you can access to the
$numbervariable in your template (where you build your form). Then in the form field where you specify the number value, just put something like this:hope this helped you! good luck