Autocomplete and update

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Autocomplete and update

Sebastian Sastre-2
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

 


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside