Using Ironspeed to develop a CRM system

Currently we are developing a CRM system using Ironspeed for a customer. The system we are developing has a lot of cool features, such as using AJAX autocompletes that populate several related fields on the form automatically whenever an option is selected. One of the difficulties we ran into was populating results into additional fields that are in an embedded table control.

For a field on the main form you can use a simple javascript statement to apply the result value from the stored procedure to another element after the autocomplete item is selected. Since the ID of the design element is always there and doesn’t change you can write something like this:

$get(‘<%# ProductDescription.ClientID %>’).value = results[0];

In the table controls, however, you can’t use this statement because the elements are different for each row, and they are created on the fly. So we need to use getElementById, the problem with this is that the IDs for each row are slightly different and they change as more rows are added. We were able to get around this issue by taking the value of the autocomplete ID  in javascript and just replacing the unique value from this ID with the unique value of the ID we needed to populate, this way we know that we are applying the results to elements in the correct row (each element in the row has a number unique to that row baked into the ID).

It can be accomplished with a simple function like this:

function OnProductSelected(source, eventArgs)


var results = eventArgs.get_value();

var product = source.get_id();

product = product.replace(“ProductAutoComplete”, “ProductDescription”);

document.getElementById(product).value = results;


In this example the autocomplete element is called “ProductAutoComplete” and the results we are getting from the stored procedure needs to be placed into the “ProductDescription” field.