V3.0.3 - Module: Forge Form_Dropdown error messages don't work

fredhowe

Joined: 2012-05-28
Posts: 12
Posted: Tue, 2012-07-03 09:22

how do i put a error message to the dropdown menu, to force a selection if nothing is selected.

like on \modules\gallery\helpers\album.php
"class album ..." > "function get_add_form(..."

$group->dropdown("albums_title")
->label(t("Title"))
->options(array("" => "please select a album","1" => "album1","2" => "album2"))
->selected("")
->error_messages("required", t("You must provide a title"));

thanks in advance
Fred

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25940
Posted: Tue, 2012-07-03 13:57

->rules('required')
should do the trick

http://docs.kohanaphp.com/addons/forge

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

Login or register to post comments
fredhowe

Joined: 2012-05-28
Posts: 12
Posted: Tue, 2012-07-03 14:37

Thanks Dave for the quick info.
looks quite simple
and it works.

Fred

Login or register to post comments
fredhowe

Joined: 2012-05-28
Posts: 12
Posted: Tue, 2012-07-03 15:01

One more question.
\modules\gallery\helpers\album.php
function get_add_form(

how do i take off all rules from a input,
if i will take care of the value and validation.
i want to change input to hidden.
like:
$group->hidden("name")->value("");
$group->hidden("slug")->value("");

but this make problems.
behind there is still a validation?

thanks in advance
Fred

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25940
Posted: Tue, 2012-07-03 17:44

Make it hidden but give the value a value that can validate.
More validation is done for the slug for example in gallery/modules/gallery/models/item.php

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

Login or register to post comments