[html-formfu] providing condition attributes for Select box while using DBIC

mohanprasad mohan at thebizmo.com
Fri Apr 3 11:53:52 BST 2009


hello everybody,

i am trying to provide a select box in a html form.
All the options should come database using DBIC.
I want to filter the database entries fetched using DBIC.
>From the documentation http://search.cpan.org/~cfranks/HTML-FormFu-Model-DBIC-0.03007/lib/HTML/FormFu/Model/DBIC.pm i got to know i can make use of condition attribute to filter the results fetched using DBIC.
Documentation is telling condition will work similar to 1st arguement in search method on a result set.
my code is as follows:

---
action:
auto_fieldset: 1
auto_id: '%f_%n'
elements:
    - type: Select
      name: media_type
      label: 'select media type:* '
      model_config:
          model: Database::mediatype
          label_column: name
          id_column: name
          condition:
             name: 'video'
      constraints:
        - Required

The above one will get all entries from mediatype table where name = 'video'.
could anybody let me know if i want to provide not condition (ex: name != 'video') or a simple where clause like(ex: (field1 = 'value1' OR filed2 != 'value2') how should i do that?

thanks in advance.

best regards,
mohan

-- 
View this message in context: http://n2.nabble.com/providing-condition-attributes-for-Select-box-while-using-DBIC-tp2580015p2580015.html
Sent from the HTML-FormFu mailing list archive at Nabble.com.




More information about the HTML-FormFu mailing list