-1

Good day! I'm learning Kohana (3.2) with Smarty (MrAnchovy-Kohana_Smarty). I created a simple form with one field which is validated after submission. I'd like the field to be repopulated with the submitted value when the validation fails. How can I do it please?

<div class="field_input">{form::input('cs_number')}</div>

Could you also recommend some framework for creating and validating forms in Kohana using Smarty? Thank you in advance! Vojtech

Vojtech
  • 2,533
  • 9
  • 34
  • 65
  • 1
    Not related, but since you are using a template engine with Kohana, take a look at https://github.com/zombor/KOstache, mustache implementation for Kohana. I think it is more flexible than Smarty, implemented in a variety of languages, including javascript, so you can use the same templates for the client side. – ZolaKt Jan 24 '12 at 11:50

1 Answers1

3

Could you also recommend some framework for creating and validating forms in Kohana using Smarty?

You can use Formo library to create forms

I'd like the field to be repopulated with the submitted value when the validation fails

You need to pass $_POST array to the template and echo it in input's value. Example: <input type="text" name="test" value="<?php echo Arr::get($post, 'test) ?>" />.

Andrzej Ośmiałowski
  • 1,464
  • 12
  • 21