cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karel Vervaeke <karel.verva...@pandora.be>
Subject Re: Fill woody repeater from flow
Date Sat, 25 Oct 2003 07:50:47 GMT
Here's an example using binding:

function searchContact(form) {
  bean = {
    qryFirstName:"",
    qryLastName:"",
    qryAddress:"",
    qryPostalCode:"",
    qryCity:"",
    qryCountry:"",
    results: undefined // we'll set it later on
  };

  form.load(bean);
  form.showForm("woody/searchContact-query.xml");
  form.save(bean);
 
  // the next 7 lines are ugly, please disregard
  var wcps = new Packages.vd.util.WhereClausePartSet();
  if (bean.qryFirstName)  wcps.add("firstName" ,bean.qryFirstName+"%"  
,"like");
  if (bean.qryLastName)   wcps.add("lastName"  ,bean.qryLastName+"%"   
,"like");
  if (bean.qryAddress)    wcps.add("address"   
,bean.qryAddressName+"%","like");
  if (bean.qryPostalCode) wcps.add("postalCode",bean.qryPostalCode+"%" 
,"like");
  if (bean.qryCity)       wcps.add("city"      ,bean.qryCity+"%"       
,"like");
  if (bean.qryCountry)    wcps.add("country"   ,bean.qryCountry+"%"    
,"like");

  // the search function is backed up by hibernate's 'find'
  list = contactReg.search(wcps); // java.util.List

  bean.results = list.toArray();
 
  form.load(bean);
  form.showForm("woody/searchContact-results.xml");
}

Feedback is of coarse, welcome.
Karel


Mime
View raw message