Hi Mansur,

> I have simple search form (see below) and there is one dropdown box
> in the form with list of predefined search filters. Is it possible
> to change values of other fields or even initiate search when occurs
> 'onchange' event of dropdown box? Should I use additional javascript
> code to do it?

You can use the '+Chg' ("change") prefix class for that. It takes a
function which receives the field's value as an argument, and should
return the (possibly modified) value. As side effects, this function may
send messages to other fields.

   (gui 'flt '(+Var +Init +Chg +TextField)
      '*IncFilter
      "All"
      '((Str)                             # "Change" function
         (set> (: home id) (someId))      # Set two other fields
         (set> (: dt) (date))
         (init> (: home query))           # and initiate the search
         Str )                            # Return the value
      '("All" "Created today" "Active") )

I'm not sure if this conflicts with the '+Init' prefix, though. Probably
not, but I would recommend anyway not to use '+Init' here, and simply
initialize the '*IncFilter' variable instead.

In general, '+Chg' is a bit dangerous. You need to take care not to
create circular dependencies between fields, because this may result in
infinite loops.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to