.ftl and Minilanguage

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

.ftl and Minilanguage

g.fitini
Hi to everyone, i’m tryng to duplicate the code generated by a form written in Ofbiz minilang, in HTML into a *.ftl file.

So, i’ve tried to copy and paste the HTML generated by :
<form ....

<field name="user" title="${uiLabelMap.changedByInfo}"><lookup target-form-name="LookupUserLoginAndPartyDetails"/></field>

</form>

and the relative HTML generated is :

<form method="post ...

    <table cellspacing="0">
   
    <tbody>
    <tr>
    <td class="label">
        <span id="QryFullLogMaster_user_title">Utente Operazione</span>
    </td>
     <td>
        <!-- @renderLookupField -->
            <script type="text/javascript">
                jQuery(document).ready(function(){
                    if (!jQuery('form[name="QryFullLogMaster"]').length) {
                    alert("Developer: for lookups to work you must provide a form name!")
                }
            });
            </script>
        <span class="field-lookup">
        <div id="0_lookupId_QryFullLogMaster_user_auto"></div>

       <input aria-haspopup="true" aria-autocomplete="list" role="textbox" autocomplete="off" class="ui-autocomplete-input" name="user" size="25" id="0_lookupId_QryFullLogMaster_user" type="text">
   
           <script type="text/javascript">
                jQuery(document).ready(function(){
                    new ConstructLookup("LookupUserLoginAndPartyDetails", "QryFullLogMaster_user", document.QryFullLogMaster.user, null, "QryFullLogMaster", "", "", "topleft", "true",                                     "                                    QryFullLogMaster_user,/log/control/LookupUserLoginAndPartyDetails,ajaxLookup=Y&amp;_LAST_VIEW_NAME_=EntityFindGenericFullGF&amp;searchValueFieldName=user", true, "layer", "2", "300");
        });
    </script>
    <a id="0_lookupId_button" href="javascript:void(0);"></a></span>

    </td>
    </tr>
    <tr>
</tbody>
</form>

but the jquery for autocomplete, and form lookup doesnt works.
So, any suggestion? What’s wrong??

Reply | Threaded
Open this post in threaded view
|

Re: .ftl and Minilanguage

Jacques Le Roux
Administrator
Rather use something like (found in checkinits.ftl)

<@htmlTemplate.lookupField value="${parameters.userLogin.userLoginId}" formName="salesentryform" name="userLoginId" id="userLoginId_sales"
fieldFormName="LookupUserLoginAndPartyDetails"/>

Jacques

Le 05/03/2014 10:09, [hidden email] a écrit :

> Hi to everyone, i’m tryng to duplicate the code generated by a form written in Ofbiz minilang, in HTML into a *.ftl file.
>
> So, i’ve tried to copy and paste the HTML generated by :
> <form ....
>
> <field name="user" title="${uiLabelMap.changedByInfo}"><lookup target-form-name="LookupUserLoginAndPartyDetails"/></field>
>
> </form>
>
> and the relative HTML generated is :
>
> <form method="post ...
>
>      <table cellspacing="0">
>      
>      <tbody>
>      <tr>
>      <td class="label">
>          <span id="QryFullLogMaster_user_title">Utente Operazione</span>
>      </td>
>       <td>
>          <!-- @renderLookupField -->
>              <script type="text/javascript">
>                  jQuery(document).ready(function(){
>                      if (!jQuery('form[name="QryFullLogMaster"]').length) {
>                      alert("Developer: for lookups to work you must provide a form name!")
>                  }
>              });
>              </script>
>          <span class="field-lookup">
>          <div id="0_lookupId_QryFullLogMaster_user_auto"></div>
>
>         <input aria-haspopup="true" aria-autocomplete="list" role="textbox" autocomplete="off" class="ui-autocomplete-input" name="user" size="25" id="0_lookupId_QryFullLogMaster_user" type="text">
>      
>             <script type="text/javascript">
>                  jQuery(document).ready(function(){
>                      new ConstructLookup("LookupUserLoginAndPartyDetails", "QryFullLogMaster_user", document.QryFullLogMaster.user, null, "QryFullLogMaster", "", "", "topleft", "true",                                     "                                    QryFullLogMaster_user,/log/control/LookupUserLoginAndPartyDetails,ajaxLookup=Y&amp;_LAST_VIEW_NAME_=EntityFindGenericFullGF&amp;searchValueFieldName=user", true, "layer", "2", "300");
>          });
>      </script>
>      <a id="0_lookupId_button" href="javascript:void(0);"></a></span>
>
>      </td>
>      </tr>
>      <tr>
> </tbody>
> </form>
>
> but the jquery for autocomplete, and form lookup doesnt works.
> So, any suggestion? What’s wrong??
>
>
Reply | Threaded
Open this post in threaded view
|

Re: .ftl and Minilanguage

Lei Wu
If I understand right, you're trying to migrate from a form widget to .ftl
files. AFAIK, .ftl files could provide more flexibility than forms, yet the
grammar is slightly different. So, you might wanna reference other similar
*.ftl files to figure out how to implement the logic in your previous form
widget.


On Wed, Mar 5, 2014 at 9:27 PM, Jacques Le Roux <
[hidden email]> wrote:

> Rather use something like (found in checkinits.ftl)
>
> <@htmlTemplate.lookupField value="${parameters.userLogin.userLoginId}"
> formName="salesentryform" name="userLoginId" id="userLoginId_sales"
> fieldFormName="LookupUserLoginAndPartyDetails"/>
>
> Jacques
>
> Le 05/03/2014 10:09, [hidden email] a écrit :
>
>  Hi to everyone, i'm tryng to duplicate the code generated by a form
>> written in Ofbiz minilang, in HTML into a *.ftl file.
>>
>> So, i've tried to copy and paste the HTML generated by :
>> <form ....
>>
>> <field name="user" title="${uiLabelMap.changedByInfo}"><lookup
>> target-form-name="LookupUserLoginAndPartyDetails"/></field>
>>
>> </form>
>>
>> and the relative HTML generated is :
>>
>> <form method="post ...
>>
>>      <table cellspacing="0">
>>           <tbody>
>>      <tr>
>>      <td class="label">
>>          <span id="QryFullLogMaster_user_title">Utente Operazione</span>
>>      </td>
>>       <td>
>>          <!-- @renderLookupField -->
>>              <script type="text/javascript">
>>                  jQuery(document).ready(function(){
>>                      if (!jQuery('form[name="QryFullLogMaster"]').length)
>> {
>>                      alert("Developer: for lookups to work you must
>> provide a form name!")
>>                  }
>>              });
>>              </script>
>>          <span class="field-lookup">
>>          <div id="0_lookupId_QryFullLogMaster_user_auto"></div>
>>
>>         <input aria-haspopup="true" aria-autocomplete="list"
>> role="textbox" autocomplete="off" class="ui-autocomplete-input" name="user"
>> size="25" id="0_lookupId_QryFullLogMaster_user" type="text">
>>                  <script type="text/javascript">
>>                  jQuery(document).ready(function(){
>>                      new ConstructLookup("LookupUserLoginAndPartyDetails",
>> "QryFullLogMaster_user", document.QryFullLogMaster.user, null,
>> "QryFullLogMaster", "", "", "topleft", "true",
>>         "                                    QryFullLogMaster_user,/log/
>> control/LookupUserLoginAndPartyDetails,ajaxLookup=Y&amp;_LAST_VIEW_
>> NAME_=EntityFindGenericFullGF&amp;searchValueFieldName=user", true,
>> "layer", "2", "300");
>>          });
>>      </script>
>>      <a id="0_lookupId_button" href="javascript:void(0);"></a></span>
>>
>>      </td>
>>      </tr>
>>      <tr>
>> </tbody>
>> </form>
>>
>> but the jquery for autocomplete, and form lookup doesnt works.
>> So, any suggestion? What's wrong??
>>
>>
>>