setNameAttribute(attributes);
final XFormBuilder builder = context.getXFormBuilder();
// determine the model that this control should appear in
XFormModel model = builder.registerControl(attributes);
pattributes.setContainingXFFormName(model.getID());
setInitialValue(builder, ref, modelID);
// populate the field descriptor
fieldDescriptor.setType(getFieldType());
// Add a reference to the field descriptor into the attributes.
pattributes.setFieldDescriptor(fieldDescriptor);
// Add a reference to the (incomplete) form data into the attributes.
pattributes.setFormAttributes(model.getXFFormAttributes());
pattributes.setFormData(model.getFormData());
// do any element specific initialisation
initialiseElementSpecificAttributes(context, attributes);
}