[Seaside] Autocomplete and update

Sebastian Sastre ssastre at seaswork.com
Mon Feb 5 14:48:49 UTC 2007


Hi there,
    
    I was trying to make a form with an autocomplete text input wanting that
when it is changed some text where updated.
 
    The scenario is that you choose a material with a code, then the text
that tells the unit for that material gets updated.
 
    I wasn't able to get it right (I'm trying to understand the event flux
with scriptaculos myself). The code I was using is this:
 
ShoreDialogWithModel subclass: #BRDMaterialToUseEditor
 instanceVariableNames: 'code'
 classVariableNames: ''
 poolDictionaries: ''
 
BRDMaterialToUseEditor>>renderFormOn: html
 
 | codeId |
 codeId _ html nextId.
 
 html table: [
  html tableRow:[
   html tableData:[html text: 'Material Code'].
   html tableData:[
    html textInput
     id: 'code';
     value: code;
     callback:[:value| code _ value];
     onChange: (html updater
          id: codeId;
          triggerForm: 'code';
          callback:[:r| self renderUnitOn: r]);
     yourself.
    html div
     class: 'autocomplete';
     script: (
      html autocompleter
       element: 'code';
       onSelected:(
        html request
         triggerFormElement: 'code');
       on: #renderCodeListOn: of: self;
       yourself)].
    ].
  html tableRow:[
   html tableData:[html text: 'Quntity'].
   html tableData:[html textInput on: #quantity of: model]].
  html tableRow:[
   html tableData:[html text: 'Unit'].
   html tableData:[html div id: 'unit'; with: [self renderUnitOn: html]].
  ].
 ]
 
    Any comments are welcomed,
 
    thanks,
 
Sebastian Sastre

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20070205/9ce240f7/attachment.htm


More information about the Seaside mailing list