Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename global javascript function: formwidget_autocomplete_new_value #44

Closed
kcleong opened this issue Oct 8, 2014 · 7 comments
Closed
Labels

Comments

@kcleong
Copy link

kcleong commented Oct 8, 2014

For the contenttree browser (plone.formwidget.contenttree) the javascript global function 'formwidget_autocomplete_new_value' is used to update the field after an item has been selected in the contenttree overlay. I'm having problems updating a field with an existing value (see: plone/plone.formwidget.contenttree#16).

This global function is registered by two modules in my Plone 4.3.3 buildout. The last results by ack-grep is in contenttree widget, the function is called from there for contenttree.

# ack --follow formwidget_autocomplete_new_value
collective/z3cform/widgets/static/related.js
3:function formwidget_autocomplete_new_value(input_box,value,label) {
64:                        formwidget_autocomplete_new_value(input_box,$(this).attr('href'),$.trim($(this).text()));

plone/formwidget/autocomplete/jquery-autocomplete/formwidget-autocomplete.js
4:        formwidget_autocomplete_new_value(input_box,data[0],data[1]);
8:function formwidget_autocomplete_new_value(input_box,value,label) {

plone/formwidget/contenttree/jquery-contenttree/contenttree.js
21:                formwidget_autocomplete_new_value(input_box,$(this).attr('href'),$.trim($(this).text()));

The function in collective/z3cform/widgets/static/related.js is conflicting with the one in collective.z3cform.widgets. Where is this function used from c.z3cform.widgets? Maybe it is an idea to rename the function, to prevent conflicts.

@kcleong
Copy link
Author

kcleong commented Oct 8, 2014

The function in autocomplete is unchecking the selected field and the one in c.z3cform.widgets is checking an selected field. Both functions aren't the same.

function in autocomplete: https://github.com/plone/plone.formwidget.autocomplete/blob/master/plone/formwidget/autocomplete/jquery-autocomplete/formwidget-autocomplete.js

function in c.z3cform.widgets: https://github.com/collective/collective.z3cform.widgets/blob/master/src/collective/z3cform/widgets/static/related.js

@hvelarde
Copy link
Member

hvelarde commented Oct 8, 2014

@puittenbroek
Copy link

Problem still exists due to both having the function AND the this product install it's js after that of autocomplete. Changing the order to have the 'related.js' before 'formwidget-autocmplete.js' fixes the problem. But it's unclear to me why the duplicity exsists at all?

@hvelarde
Copy link
Member

@puittenbroek we're no longer using this package; sorry, but I can't help further.

@puittenbroek
Copy link

Well the only problem I still have is due to collective.polls using this package.
collective/collective.polls#107

@hvelarde
Copy link
Member

we can help on that :-)

@puittenbroek
Copy link

Was hoping on that ;) I'll close this issue one in favor of that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants