document.getElementById("FirstName").value = x;
Thanks Linday, is there a way of populating a value on a lookup field before the use clicks the lookup field to trigger the onlookup method or typing a default value on the value property on the lookup field.
The reason I want to do this is, we have a standard where we include the cost center nomber on our location name, I want to extract the cost center on the loaction name and populate it on a lookup field if the user want to update the cost center
on this location they would click it and select a different cost center, if it is correct, the would just leave the value and update other fields.
So I want to populate my lookup field onLoad and not onlookup.
Thanks again Lindsay, I hope this makes sence now.
I don't have an easy answer for you as this falls into the "How do I made the tool work the way I wish it would work instead of the way it was designed to work?" realm. In your standard you have re-purposed Location Name into a combo Location/CostCenter Name where Location has a specific Cost Center except in some Requests where it differs.
Here is how I might approach this:
Add another lookup control on your form (perhaps named "Cost Center Override" that could use a report data object accessing the ca_resource_cost_center table.
You can set and get value from a lookup with the ca_fdGet and ca_fdSetTextFieldValue
So : ca_fdSetTextFieldValue(formId, "lkp_1", "toto"); wirtes toto in the lkp_1 lookup.
Replace "toto" with the cost center, returned from a ca_reportQuery.
Possq advice worked for me, Do you perhaps know how can do the same this for a select field. Thanks Guys
You cannot set a value to a select field.
You need to Select an options in it using :
ca_fdSelectOption(formId, _id, name, value)
ca_fdSelectOptionByIndex(formId, _id, index).
Before selecting a value you need to fetch the data.
There's 2 way.
Set the Select field attribute "Eager" to true. It will load the data when the form load instead of when a user click on it.