foreach (pq('af-field', $doc) as $afField) {
/** @var DOMElement $afField */
$fieldName = $afField->getAttribute('name');
- $entityName = pq($afField)->parent('af-fieldset[model]')->attr('model'); // TEST ME
+ $entityName = pq($afField)->parent('af-fieldset[model]')->attr('model');
if (!preg_match(';^[a-zA-Z0-9\_\-\. ]+$;', $entityName)) {
throw new \CRM_Core_Exception("Cannot process $path: malformed entity name ($entityName)");
}
--- /dev/null
+<af-form ctrl="modelListCtrl" >
+ <div crm-ui-debug="modelListCtrl.getEntity('parent')" />
+ <div crm-ui-debug="modelListCtrl.getData('parent')" />
+ <af-model type="Contact" data="{contact_type: 'Individual'}" name="parent" label="Parent" url-autofill="1" autofill="user" />
+ <af-model type="Contact" name="spouse" label="Spouse" url-autofill="1" />
+ <af-model type="Contact" name="home" label="Home" />
+
+ <af-fieldset model="parent">
+
+ <af-field name="first_name" defn='{title: ts("Your First Name")}' />
+ <af-field name="last_name" />
+ <af-field name="contact_sub_type" defn="{widget: hidden}" value="Student" />
+ <af-field name="gender_id" />
+ <af-field name="constituent_information.Marital_Status" />
+ <af-field name="constituent_information.Marriage_Date" />
+ <af-field name="constituent_information.Most_Important_Issue" />
+ </af-fieldset>
+
+ <af-fieldset model="spouse">
+ <af-field name="first_name" defn='{title: ts("Spouse First Name")}' />
+ <af-field name="last_name" />
+ </af-fieldset>
+
+ <!-- General elements: FIELDSET, UL, BUTTON, P, H1 should work anywhere -->
+ <button ng-click="modelListCtrl.submit()">Submit</button>
+
+</af-form>
--- /dev/null
+{
+ "server_route": "civicrm/test-afform",
+ "title": "This is a test",
+ "requires": [
+ "af", "afBlock", "afField", "afCore"
+ ]
+}