If someone to have some other idea that can to solve, I'm ready to listen.

Thanks.

2012/8/13 William Lopes <williamlopes....@gmail.com>

> Hi guys.
>
> I'm already for done my project, but now the things are too ugly.
>
> So, I need make an autocomplete, the default I already did, but don't work
> of the way that I need.
>
> I have a form dynamic, so all my fields are dynamics, with it I can't use
> the default autocomplete, because it don't distinguish which field is and
> so I can't prepare the autocomplete correctly.
>
> My .tml:
>
>> <t:form t:type="form" t:id="AtualizarForm">
>>  <t:errors t:banner="${message:default-banner}"/>
>> <table id="usuarioFormTable">
>>  <tr>
>> <t:loop source="listAtributoGeneric" value="currentAtributoGeneric"
>> encoder="encoder">
>>  <t:submitNotifier>
>> <tr>
>> <td align="right">${currentAtributoGeneric.name}:</td>
>>  <td width="10"/>
>> <td align="left">
>> <t:delegate to="activeBlock"/>
>>  </td>
>> </tr>
>> </t:submitNotifier>
>>  </t:loop>
>> </tr>
>> </table>
>>
>> <table>
>> <tr><td colspan="3" align="center">
>>  <br />
>> <input type="submit" t:type="submit" t:id="salvaButton"
>> value="${message:salvar-label}" class="buttonSubmit" />
>>  </td></tr>
>> </table>
>>
>>  </t:form>
>>
>> <t:block id="stringBlock">
>>  <t:textfield value="currentAtributoGeneric.value"
>> label="${currentAtributoGeneric.name}" translate="string"
>>  validate="maxLength=255" t:id="stringGeneric" size="50"/>
>>  </t:block>
>> <t:block id="stringLargeBlock">
>> <t:textarea value="currentAtributoGeneric.value"
>> label="${currentAtributoGeneric.name}" translate="string"
>>  validate="maxLength=2048" t:id="stringLargeGeneric" rows="3" cols="49"/>
>> </t:block>
>>  <t:block id="dateBlock">
>> <t:datefield value="currentAtributoGeneric.value" format="dd/MM/yyyy"
>> label="${currentAtributoGeneric.name}"
>>  validate="maxLength=10,regexp" t:id="dateGeneric"
>> onkeypress="javascript:formataData(this.value, this.id, event);"
>> size="12" />
>>  </t:block>
>> <t:block id="numericBlock">
>> <t:textfield value="currentAtributoGeneric.value"
>> label="${currentAtributoGeneric.name}" translate="string"
>>  validate="maxLength=20,regexp" t:id="numericGeneric" size="20"/>
>> </t:block>
>>  <t:block id="numericDecimalBlock">
>> <t:textfield value="valorDecimal" label="${currentAtributoGeneric.name}"
>> translate="string"
>>  validate="maxLength=18,regexp" t:id="numericDecimalGeneric"
>> onkeypress="javascript:formataDecimal(this, 17, event, 2)" size="20"/>
>>  </t:block>
>> <t:block id="modeloDadosBlock">
>> <t:textfield value="currentAtributoGeneric.value"
>> label="${currentAtributoGeneric.name}" translate="string"
>>  validate="maxLength=50" t:id="modeloDadosGeneric"
>> t:mixins="Autocomplete" size="50"/>
>> </t:block>
>
>
>
> .java:
>
>> List<String> onProvideCompletionsFromModeloDadosGeneric(String partial) {
>
>  List<Material> matches = null;
>
>  try {
>
>  matches = service.getAllByFiltroTextoAndModeloDados(partial,
>> modeloDados);
>
>  } catch (Exception e) {
>
>  System.out.println("Erro em " + this);
>
>  e.printStackTrace();
>
>  }
>
>
>>  List<String> result = new ArrayList<String>();
>
>
>> for (Material i : matches) {
>
>  for(ValorAtributo j : i.getValoresAtributo()) {
>
>  if((j.getAtributo().getTipoAtributo() == TipoAtributo.TEXTO_GRANDE
>
>  || j.getAtributo().getTipoAtributo() == TipoAtributo.TEXTO_PEQUENO)
>
>  && j.getValor().toLowerCase().contains(partial.toLowerCase())) {
>
>  result.add(i.getId() + " - " + j.getValor());
>
>  break;
>
>  }
>
>  }
>
>  }
>
>
>>  return result;
>
>  }
>
>
> How you can see, in *matches =
> service.getAllByFiltroTextoAndModeloDados(partial, modeloDados);* , I
> need of a parameter for can define which modeloDados is.
>
> How I could do it? (following the default of the Tapestry)
>
> Thanks!
>

Reply via email to