Not just another Autocomplete question

Login or register to post comments
4 replies [Last post]
LaCeja's picture
Offline
Joined: 11/04/2009

Hi guys! I've got a little problem that maybe someone can advise me on.

I have program, that is used to enter orders (manufacturing orders). Basically, the user has two ways to do it. One is to enter the part number of an order and the program (with an ajax call) creates the list of operations that get performed to process that part. However, if the part has never been processed before, the user must enter the Process ID of the process to be applied.

The problem is this, both the Part Number and Process ID controls are Autocomplete controls. However, if the Part Number is discovered to already exist, I need to "turn off" the Autocomplete for the Process ID. I don't want to make it "Read Only", because, for documentation purposes, the user may change the value. I just need to be able to turn off the Autocomplete. Is this possible?

I've tried doing an unset on the control and re-creating it, but that doesn't work. You get an error message that the object (ie. $this->txtProcessId) doesn't exist, when trying to create a "new" one.

Any ideas?

Thanks,

LaCeja

alex94040's picture
Offline
Joined: 11/06/2008

Thoughts for you: I'm guessing your Autocomplete control is a server-side autocompleter; if so, in your server-side logic, you can just check a variable - the variable you'll set whenever you want to - and if it's set, return an empty set for the auto-complete matches. That effectively disables autocomplete. Would that work for you?

LaCeja's picture
Offline
Joined: 11/04/2009

Yea, thanks Alex. I hadn't thought of that. I was focusing on a way to disable Autocomplete, but I think your idea will work. I'll try that out and see how it works.

Thanks again... and thanks for the very quick response!

LaCeja

LaCeja's picture
Offline
Joined: 11/04/2009

Works perfectly! Thanks again, Alex!

alex94040's picture
Offline
Joined: 11/06/2008

My pleasure, good luck! Sometimes a speedy solution is all you need - no fancy architecture is necessary :-)