[
https://issues.apache.org/jira/browse/OFBIZ-3932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908364#action_12908364
]
Jacques Le Roux commented on OFBIZ-3932:
----------------------------------------
OK, I was wrong for jQuery and this is brilliantly demonstrated at
http://view.jquery.com/trunk/plugins/autocomplete/demo/
The code is simply
{code}
$("#suggest4").autocomplete('search.php', {
width: 300,
multiple: true,
matchContains: true,
formatItem: formatItem,
formatResult: formatResult
});
$("#suggest4").result(function(event, data, formatted) {
var hidden = $(this).parent().next().find(">:input");
hidden.val( (hidden.val() ? hidden.val() + ";" : hidden.val()) + data[1]);
});
<p>
<label>Multiple Birds (remote):</label>
<textarea id='suggest4'></textarea>
<input type="button" value="Get Value" />
</p>
<p>
<label>Hidden input</label>
<textarea></textarea>
</p>
{code}
search.php is there
http://view.jquery.com/trunk/plugins/autocomplete/demo/search.phps
It is much like what I suggested with _"I suggested a slightly better solution
by using fields positions instead of names"_
> We can't use autocompletion in lookups with a dependent field
> -------------------------------------------------------------
>
> Key: OFBIZ-3932
> URL: https://issues.apache.org/jira/browse/OFBIZ-3932
> Project: OFBiz
> Issue Type: Improvement
> Affects Versions: SVN trunk
> Reporter: Jacques Le Roux
> Assignee: Jacques Le Roux
> Priority: Minor
>
> We can't use autocompletion in lookups with a dependent field. For instance a
> Name for the lookups field and an hidden field for the Id (or vice versa
> which makes less sense, if any). This is not a problem OOTB, but in the
> Example component where such a sctructure is used (2d lookup)
> I tried a clumsy solution at r993508, but David had to revert it because it
> was breaking all current lookups OOTB.
> This solution was based on a couple of names for the fields. I suggested a
> slightly better solution by using fields positions instead of names. It's
> less intrusive, especially if we put some tests, but still unsure.
> Of course the best method would be to use the description-field-name. But it
> would need to change the current lookup structure. Because the autocomplete
> feature is Ajax based and either using Prototype/Scriptaculous or jQuery we
> don't have the possibility to change the value of the hidden dependent field
> ([more in this thread|http://markmail.org/message/7adznlrdmdmwx2tr].
> Note: I had a look at [extraParams in jQuery which handles Dependencies
> between
> fields|http://docs.jquery.com/Plugins/autocomplete#Dependencies_between_fields].
> It's great but what we need is other way around. Here you define how the
> load is done on the autcompleted field and we want to set a related (ID)
> value on an hidden field after the user has selected the value (Name) in the
> autcompleted field.
> At least it is what I found so far...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.