[jQuery] Re: [autocomplete] Problem with .result

2009-02-06 Thread Han

Has anyone figured out a solution to this?

I'm trying to modify the autocomplete plugin so that it triggers a
different function (something like clearField() instead of result())
when you click anywhere outside of the autocomplete search.  You can
then write some javascript to clear the hidden field and do whatever
else you want it to do in your document.

I basically want to constrain the user to select something that the
autocomplete returns, and nothing else.

On Jan 26, 7:37 pm, Aaron Jensen aaronjen...@gmail.com wrote:
 Yeah, we've run into this same trouble as well. It would be nice if
 there was a hook to handle this built intoAutocomplete.

 On Mon, Jan 26, 2009 at 3:18 AM, Styx pawel.chuchm...@gmail.com wrote:

  It dosen't work.
  For example: I use tab key to navigate. If focus is set to input, id
  will be empty. If I don't want change my input, id also shouldn't be
  change.
  IAnother example: If my result work and set id properly, if I keypress
  shift or ctrl, id field will be cleared.

  On 24 Sty, 00:20, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:
  You could add another keyup-event-handler to the input field, and
  clear the id field. As long as that runs before the result-handler is
  setting the data, it should give you the result you need.

  Jörn

  On Fri, Jan 23, 2009 at 5:09 PM, Styx pawel.chuchm...@gmail.com wrote:

   Hi.

   I have two fileds. For exmple:

   $(#name).autocomplete('seatch.php');
   $(#id).result(function(event, data, formatted) {
    if (data) {
      $(#id).val(data[1]);
    }

   If i select sometfing inautocompletefield, my id field will have id
   of this item. After submit I have two fields - one wieth name, and one
   with id. I can for example update dabase use id.

   But if I write inautocompletesomethig, which isn't in result, my
   function isn't triggered. If i edit existing data, after submit I have
   field id with some value, and filed name with new value. I don't
   know, that I shoul add my name to database, or do something else.

   What I should do to clear field id when name is write by me and
   dosen't exist in result of 'search.php'?

   regards,
   pch


[jQuery] Re: [autocomplete] Problem with .result

2009-01-26 Thread Styx

It dosen't work.
For example: I use tab key to navigate. If focus is set to input, id
will be empty. If I don't want change my input, id also shouldn't be
change.
IAnother example: If my result work and set id properly, if I keypress
shift or ctrl, id field will be cleared.

On 24 Sty, 00:20, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 You could add another keyup-event-handler to the input field, and
 clear the id field. As long as that runs before the result-handler is
 setting the data, it should give you the result you need.

 Jörn

 On Fri, Jan 23, 2009 at 5:09 PM, Styx pawel.chuchm...@gmail.com wrote:

  Hi.

  I have two fileds. For exmple:

  $(#name).autocomplete('seatch.php');
  $(#id).result(function(event, data, formatted) {
   if (data) {
     $(#id).val(data[1]);
   }

  If i select sometfing in autocomplete field, my id field will have id
  of this item. After submit I have two fields - one wieth name, and one
  with id. I can for example update dabase use id.

  But if I write in autocomplete somethig, which isn't in result, my
  function isn't triggered. If i edit existing data, after submit I have
  field id with some value, and filed name with new value. I don't
  know, that I shoul add my name to database, or do something else.

  What I should do to clear field id when name is write by me and
  dosen't exist in result of 'search.php'?

  regards,
  pch


[jQuery] Re: [autocomplete] Problem with .result

2009-01-26 Thread Aaron Jensen

Yeah, we've run into this same trouble as well. It would be nice if
there was a hook to handle this built into Autocomplete.


On Mon, Jan 26, 2009 at 3:18 AM, Styx pawel.chuchm...@gmail.com wrote:

 It dosen't work.
 For example: I use tab key to navigate. If focus is set to input, id
 will be empty. If I don't want change my input, id also shouldn't be
 change.
 IAnother example: If my result work and set id properly, if I keypress
 shift or ctrl, id field will be cleared.

 On 24 Sty, 00:20, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:
 You could add another keyup-event-handler to the input field, and
 clear the id field. As long as that runs before the result-handler is
 setting the data, it should give you the result you need.

 Jörn

 On Fri, Jan 23, 2009 at 5:09 PM, Styx pawel.chuchm...@gmail.com wrote:

  Hi.

  I have two fileds. For exmple:

  $(#name).autocomplete('seatch.php');
  $(#id).result(function(event, data, formatted) {
   if (data) {
 $(#id).val(data[1]);
   }

  If i select sometfing in autocomplete field, my id field will have id
  of this item. After submit I have two fields - one wieth name, and one
  with id. I can for example update dabase use id.

  But if I write in autocomplete somethig, which isn't in result, my
  function isn't triggered. If i edit existing data, after submit I have
  field id with some value, and filed name with new value. I don't
  know, that I shoul add my name to database, or do something else.

  What I should do to clear field id when name is write by me and
  dosen't exist in result of 'search.php'?

  regards,
  pch


[jQuery] Re: [autocomplete] Problem with .result

2009-01-23 Thread Jörn Zaefferer

You could add another keyup-event-handler to the input field, and
clear the id field. As long as that runs before the result-handler is
setting the data, it should give you the result you need.

Jörn

On Fri, Jan 23, 2009 at 5:09 PM, Styx pawel.chuchm...@gmail.com wrote:

 Hi.

 I have two fileds. For exmple:

 $(#name).autocomplete('seatch.php');
 $(#id).result(function(event, data, formatted) {
  if (data) {
$(#id).val(data[1]);
  }

 If i select sometfing in autocomplete field, my id field will have id
 of this item. After submit I have two fields - one wieth name, and one
 with id. I can for example update dabase use id.

 But if I write in autocomplete somethig, which isn't in result, my
 function isn't triggered. If i edit existing data, after submit I have
 field id with some value, and filed name with new value. I don't
 know, that I shoul add my name to database, or do something else.

 What I should do to clear field id when name is write by me and
 dosen't exist in result of 'search.php'?

 regards,
 pch