Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #656 (closed enhancement: fixed)

Opened 13 years ago

Last modified 12 years ago

[PATCH] Clears out the hidden field on no match

Reported by: owen Owned by: anonymous
Priority: normal Milestone: 0.9a2
Component: TG Widgets Version:
Severity: normal Keywords:
Cc:

Description

When using the autocompelte with the new hidden field, ran into a problem. What if you want to remove the value and submit the form. The hidden field still contains the id as it is only updated when using the auto-complete magic.

So I created a small patch that clears out the hidden field whenever the field is modified and no auto-complete match was found.

Attachments

autocplt_clears_hidden_field_on_no_match.patch Download (1.3 KB) - added by owen 13 years ago.
Patches the autocomplete.js file to clear hidden field
autocplt_clears_on_selectall.patch Download (1.3 KB) - added by owen 13 years ago.
Patch to clear hidden field, a little better
autocplt_clears_on_selectall.2.patch Download (1.5 KB) - added by owen 13 years ago.
Patch to clear hidden field, a little better

Change History

comment:1 Changed 13 years ago by owen

  • Summary changed from Clears out the hidden field on no to Clears out the hidden field on no match

I found a small bug with this patch. Please do not use this one. I will upload a new version quite soon.

Changed 13 years ago by owen

Patches the autocomplete.js file to clear hidden field

comment:2 Changed 13 years ago by owen

Bug has been fixed. Lost focus will no long clear out the hidden field when it should not be cleared.

Added benefit with new way of clear checking: Now if the user performs an auto-complete, modifies the result, then changes back to what the auto-complete returned, the hidden field will be filled in again with the auto-complete original result.

comment:3 Changed 13 years ago by michele

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone set to 0.9a2

Committed in r920.

Thanks Owen!

Changed 13 years ago by owen

Patch to clear hidden field, a little better

comment:4 Changed 13 years ago by owen

  • Status changed from closed to reopened
  • Resolution fixed deleted

Found another bug. If you select all the text in the field, then deelte all the text, the keyUp function does not fire to clear the hidden field. I've fixed it, but the code less less then fantastic. Getting selection was worse, but if someone has a better way to do it, please let me know.

I also did a bit of formatting on the keypress function (why the code looks the same in the trac)

Changed 13 years ago by owen

Patch to clear hidden field, a little better

comment:5 Changed 13 years ago by owen

Silly internet explorer didn't like null being assigned to the text field (converted it to a string, silly noob oversight on my part). autocplt_clears_on_selectall.2.patch based off r930 will fix that. Sorry for all these half patches. This is honestly my first contributions to an open source project so I'm a little new :-P Hopefully this will be the last of these,

-Owen Mead-Robins

comment:6 Changed 13 years ago by roger.demetrescu

Hi Owen, welcome on board...

Just a tip from a "beginner" too: when you come to a final patch, don't forget to rename the Summary prefixing the word "[PATH]", so it can appears in the Pending Patches Report.

Cheers

Roger

comment:7 Changed 13 years ago by anonymous

  • Summary changed from Clears out the hidden field on no match to [PATCH] Clears out the hidden field on no match

comment:8 Changed 13 years ago by simon

  • Status changed from reopened to closed
  • Resolution set to fixed

Commited in r941. Thanks!

Note: See TracTickets for help on using tickets.