So i am using the standard Eloqua datalookup script and when I enter the UniqueID of a record that exists in my CDO it returns the fields nicely and everyone is happy! yay!
My observation has been that:
- datalookup push script is run
- SetElqConent() function is then run
- Form is populated with known values from the CDO
*note - The project I am working on is a form that pushes data to a CDO, what I am trying to do is create a validation system that prevents people from accidentally overwriting the CDO entry if the UniqueID already exists.
*sub-note - yes, the UniqueID is being entered by the user...
Goal:
There are at lest 2 other scenarios that I would like to code against:
1. The UniqueID does not exist in the CDO.
2. The datalookup was unresponsive. For example, Eloqua is down, etc... (I know, this last one is highly unlikely to occur, but i want to cover my bases)
Problem:
Turns out the datalookup is more complex than I thought it was. I tried firing the datalookup on the submit click and the problem seems to be that the lookup is asyncronous, so I am having trouble making sure the lookup finishes before the form actually submits. Temporarily I have put a timer on the submit so that it waits a full second before the submit completes and that seems to be working, but I am wary relying on the lookup to finish running in a set amount of time.
In my mind it would be excellent if there were a way to get 1 of 3 responses from the datalookup:
1. Record Found
2. No Record Found
3. System Unresponsive/Error
Does anyone have any thoughts? Ever run into anything similar? Feel free to ask for additional questions! (Such-as, what the hell are you doing?)