Just the other day we had a requirement from the client where the in the contact form, if the user enters the zip code, state and the City would be populated automatically based on the zip code entered and the user should not be able to edit the state and the City fields.
Simple isn’t it. City schema name is address1_city and for state it is address1_stateorprovince. So my colleague was trying the following statements.
And sadly enough it did not work. My colleague was getting an error.
The question is WHY? The reason is address1_city and address1_stateorprovince are individual elements of the composite control address1_composite. To fetch the individual control of the composite control, the format is <composite control name>_compositionLinkControl_<individual control name>. So to access the city control the code to do that would be as specified below.
And you are done!
Please note: This would not work in tablet client since in tablet client, all the composite controls fields are rendered individually on the form. Hence to get access to the control you just have to specify. its schema name.