I'm using 1.8.1 autocompleter as shown below:

new Ajax.Autocompleter("companyName", "companyHint", "abc.php",
{paramName: "companyName", minChars: 1, indicator: 'inprogress',
callback: null, afterUpdateElement: getSelectedId});

function getSelectedId(text, li) {
        $('company_id').value = li.id;

As you see above, I'm setting the value of id from <li> to the
company_id variable. What I need is that if I enter couple of spaces
in the textbox & do not type anything, then how can I unset the
company_id value?

Basically, assume follwing sequence:
1. I'm typing xyz in the textbox
2. I got the result & selected xyz.
3. Due to the selection, company_id is set from <li>
4. Now, I deleted xyz from text box & entered couple of spaces or some
other character which does not exist in database.
5. The result didn't show up since no match occured.
6. However, the company_id is still set to the earlier value of xyz's
id. This is causing problem when the form is submitted to the next

How can I unset the earlier value of selection?

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to