Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Autocomplete
#1
I created this branch as a testcase for autocompletion. This works in detailview, but I can't get something similar in createview, because it is much harder to get the related module name of the UI 10 field there. I'd like to discuss a roadmap to edit the core, so that we can add a class or a 'data-' field (or both) to the input fields, in order to create a robust autocomplete mechanism for these fields. Is that something we could do?
Reply
#2
Or any other suggestion for creating ui10 fields with autocomplete? I'd be happy to work on this, because I think it is one of the UI's bottlenecks.
Reply
#3
I haven't been able to get to this. I will try to do so this weekend.
I would like to call your attention to the two system functions for autocomplete:

getFieldAutocomplete
https://github.com/tsolucio/corebos/blob...ns.php#L25

and getReferenceAutocomplete
https://github.com/tsolucio/corebos/blob...ns.php#L59
Joe
TSolucio
Reply
#4
Nice, so some work has been done here. Which URI should we use to reach these functions? And how would we determine which module a UI10 field relates to, so we can set the module to search? Great news, I'm eager to contribute to this.
Reply
#5
You can find an example of the Reference Autocomplete in the coreBOS Webservice Development tool:


https://github.com/tsolucio/coreBOSwsDev...mplete.php

this is the method we use to implement autocomplete on satellite (webservice) applications.

It is also available from inside the application calling via AJAX to:


PHP Code:
index.php?module=Utilities&action=UtilitiesAjax&file=ExecuteFunctions&functiontocall=getReferenceAutocomplete&searchinmodule={modules}&limit


The getFieldAutocomplete is the same just that it permits you to specify on what fields you want to search, while the getReferenceAutocomplete always searches on the modules' reference field

As to the module, each ui10 field has two other fields associated to it, one ending in _type and the other ending in _display. The first holds the current module and the second is the value shown on screen. So, for example, if we have a uitype10 field called related_to which can be selecting Accounts or Contacts you will have:


PHP Code:
<select id="related_to_type" name="related_to_type"....>two optionsone for accounts and the other for contacts....
<
input type="hidden" id="related_to" name="related_to">
<
input type="text" id="related_to_display" name="related_to_display"

HTH
Joe
TSolucio
Reply
#6
Again, good to have you around.

Ah, and so the action function definition is in "include/utils/utils.php" or "include/utils/CommonUtils.php". These functions return one value at a time I'm guessing? So for let's say a hook that fills out address fields on account selection in (for instance) an Invoice or SO we'd have to write some additional javascript that hooks into the selection of an autocomplete function?

I'll do some exploring and see if I can set up a testcase.

I checked a UI10 field (for salesorder selection on an invoice), the HTML looked like:

Code:
<input name="salesorder_name" readonly="" style="border:1px solid #bababa;" value="" type="text">
<input name="salesorder_id" value="" type="hidden">&nbsp;
<img src="themes/MajorLabel/images/select.gif" alt="Selecteer" title="Selecteer" onclick="selectSalesOrder();" style="cursor:hand;cursor:pointer" align="absmiddle">&nbsp;
<input tabindex="" src="themes/images/clear_field.gif" alt="Leegmaken" title="Leegmaken" onclick="this.form.salesorder_id.value=''; this.form.salesorder_name.value='';return false;" style="cursor:hand;cursor:pointer" type="image" align="absmiddle">

I could get the module name from the hidden input field name, but I don't see the fields you were talking about. Am I checking the wrong place or the wrong fieldtype?
Reply
#7
I just had a close look at your branch, you are already using this method there. These methods returns up to "limit" parameter values if found. So you call this method as the user types in the input box and show values as they return.
Try connecting our Time control app to some coreBOS with that module installed. Create a new TC and start typing in the account box, you will see values appear, once you select an account, start typing in the invoice field and you will see a list of invoices related to that account.

------------------------------------------
The SalesOrder field on Invoice is not a uitype10, it is an 80, a special custom type from when ui10 did not exist. I wouldn't modify those, concentrate on adding the functionality to ui10 and then we can dedicate time to converting the special ones into ui10 and eliminating their specific code.
Joe
TSolucio
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)