Scipio Lookup Form


#1

Hey I’m a newbie, I wanted to create a lookup that pops up on the screen like in previous versions of Apache Ofbiz, In Scipio, instead of popping up it auto completes by giving me the options below my text field. Is there a way to bring the pop ups back?


#2

Hi Frank,

welcome to the Scipio forum. Sure there is:

http://www.scipioerp.com/community/developer/freemarker-macros/htmlinfo/#entry-modal

For a sample implementation, you can always rely on: /framework/webtools/webapp/webtools/layout/layoutdemo.ftl - https://localhost:8443//admin/control/WebtoolsLayoutDemo.
.


#3

Addendum: the form field lookup is always tied to specific fields - you can use wildcards ("%") to search for ids, but if you are looking for a full search form to popup, a combination of modal and a small javascript should be your friend:

<@modal id="myModal" label="Click Me">
<@form id="lookupForm">
  //my lookup form

<@field type="submit" value="search"/>
</@form>
  </@modal>

<@script>
 $(document).ready(function() {
        $( "form#lookupForm" ).on( "submit", function( event ) {
                          event.preventDefault();
                           $.ajax({
                                  type: "POST",
                                  url: "<@ofbizUrl>myUrl</@ofbizUrl>",
                                  data: getFormData(),
                                  dataType: "json",
                                  cache:false,
                                  async:true,
                                  success: function(data) { 
                                           // Update field with id 

//close modal
$('#myModal').foundation('reveal','close');
                                        }
                                });
                                return false;
                        }
                        });
    });
</@script>

I will check back with the other devs if there are already simpler alternatives for you - otherwise i will discuss if we may add support for full form lookups inclusion in future versions.


#4

I know this is an old topic, but perhaps it is worth mentioning that lookup fields have been implemented last week. They automatically enhance the already existing autocomplete fields (and are generally compatible with form widgets). So all screens which had them in the past should have them again now.