processwire / processwire-issues

ProcessWire issue reports.
45 stars 2 forks source link

Page Autocomplete won't work properly if labelFieldFormat contains a hash character (#) #1683

Closed teppokoivula closed 1 year ago

teppokoivula commented 1 year ago

Short description of the issue

Page Autocomplete refuses to work properly if labelFieldFormat contains a hash character (#). Resulting URL gets cut off in the middle of the "get=" part, and e.g. search fields configured for field are not used at all, just the base selector:

/processwire/page/search/for?&templates_id=106%7C3&limit=50&format_name=autocomplete_recipient&get={full_name}%20(

Expected behavior

Hash should work as expected (encoded in the URL?) or alternatively it should be stripped from request altogether to avoid this issue.

Steps to reproduce the issue

  1. Create an autocomplete field
  2. Configure one or more fields to use Page Auto Complete settings
  3. Use "custom format" for labels
  4. Use a hash in custom format, e.g. "{title} (#{id})"
  5. Attempt to find pages using this field and check the XHR request — the request should be cut off, and search will not use the fields you configured in step 2

Setup/Environment

ryancramerdesign commented 1 year ago

Thanks @teppokoivula I've pushed a fix for this.