diff --git a/src/Forms/FormAction.php b/src/Forms/FormAction.php index 0cc5985d8..99a69b87b 100644 --- a/src/Forms/FormAction.php +++ b/src/Forms/FormAction.php @@ -173,20 +173,23 @@ class FormAction extends FormField return 'action'; } - public function getAttributes() + public function getInputType() { if (isset($this->attributes['type'])) { - $type = $this->attributes['type']; + return $this->attributes['type']; } else { - $type = (isset($this->attributes['src'])) ? 'image' : 'submit'; + return (isset($this->attributes['src'])) ? 'image' : 'submit'; } + } + public function getAttributes() + { return array_merge( parent::getAttributes(), array( 'disabled' => ($this->isReadonly() || $this->isDisabled()), 'value' => $this->Title(), - 'type' => $type, + 'type' => $this->getInputType(), 'title' => ($this->useButtonTag) ? $this->description : null, ) ); diff --git a/src/Forms/PopoverField.php b/src/Forms/PopoverField.php index a5bab03ab..0ec7589b7 100644 --- a/src/Forms/PopoverField.php +++ b/src/Forms/PopoverField.php @@ -30,6 +30,8 @@ class PopoverField extends FieldGroup */ protected $popoverTitle = null; + protected $inputType = null; + /** * Placement of the popup box, relative to the element triggering it. * Valid values: bottom, top, left, right. diff --git a/tests/php/Forms/FormSchemaTest/testGetNestedSchema.json b/tests/php/Forms/FormSchemaTest/testGetNestedSchema.json index e56722526..dc060b0d5 100644 --- a/tests/php/Forms/FormSchemaTest/testGetNestedSchema.json +++ b/tests/php/Forms/FormSchemaTest/testGetNestedSchema.json @@ -16,7 +16,8 @@ { "id": "Form_TestForm_Name", "name": "Name", - "type": "Text", + "type": "text", + "schemaType": "Text", "component": null, "holderId": "Form_TestForm_Name_Holder", "title": "Name", @@ -35,7 +36,8 @@ { "id": "Form_TestForm_SecurityID", "name": "SecurityID", - "type": "Hidden", + "type": "hidden", + "schemaType": "Hidden", "component": null, "holderId": "Form_TestForm_SecurityID_Holder", "title": "Security ID", @@ -57,7 +59,8 @@ "id": "Form_TestForm_action_save", "title": "Save", "name": "action_save", - "type": null, + "type": "submit", + "schemaType": null, "component": "FormAction", "holderId": "Form_TestForm_action_save_Holder", "source": null, @@ -80,7 +83,8 @@ "id": "Form_TestForm_action_cancel", "title": "Cancel", "name": "action_cancel", - "type": null, + "type": "submit", + "schemaType": null, "component": "FormAction", "holderId": "Form_TestForm_action_cancel_Holder", "source": null, @@ -103,7 +107,8 @@ "id": "Form_TestForm_Moreoptions", "title": "More options", "name": "Moreoptions", - "type": "Structural", + "schemaType": "Structural", + "type": null, "component": "PopoverField", "holderId": "Form_TestForm_Moreoptions_Holder", "source": null, @@ -133,7 +138,8 @@ "id": "Form_TestForm_action_publish", "title": "Publish record", "name": "action_publish", - "type": null, + "type": "submit", + "schemaType": null, "component": "FormAction", "holderId": "Form_TestForm_action_publish_Holder", "source": null, @@ -156,7 +162,8 @@ "id": "Form_TestForm_action_archive", "title": "Archive", "name": "action_archive", - "type": null, + "type": "submit", + "schemaType": null, "component": "FormAction", "holderId": "Form_TestForm_action_archive_Holder", "source": null, diff --git a/tests/php/Forms/FormSchemaTest/testGetSchema.json b/tests/php/Forms/FormSchemaTest/testGetSchema.json index 47d31ad56..fed186457 100644 --- a/tests/php/Forms/FormSchemaTest/testGetSchema.json +++ b/tests/php/Forms/FormSchemaTest/testGetSchema.json @@ -16,7 +16,8 @@ { "id": "Form_TestForm_SecurityID", "name": "SecurityID", - "type": "Hidden", + "type": "hidden", + "schemaType": "Hidden", "component": null, "holderId": "Form_TestForm_SecurityID_Holder", "title": "Security ID", @@ -34,4 +35,4 @@ } ], "actions": [] -} \ No newline at end of file +} diff --git a/tests/php/Forms/FormSchemaTest/testSchemaValidation.json b/tests/php/Forms/FormSchemaTest/testSchemaValidation.json index 3720c3342..69d4c5476 100644 --- a/tests/php/Forms/FormSchemaTest/testSchemaValidation.json +++ b/tests/php/Forms/FormSchemaTest/testSchemaValidation.json @@ -16,7 +16,8 @@ { "name": "Name", "id": "Form_TestForm_Name", - "type": "Text", + "type": "text", + "schemaType": "Text", "component": null, "holderId": "Form_TestForm_Name_Holder", "title": "Name", @@ -40,7 +41,8 @@ { "name": "Date", "id": "Form_TestForm_Date", - "type": "Date", + "type": "date", + "schemaType": "Date", "component": null, "holderId": "Form_TestForm_Date_Holder", "title": "Date", @@ -66,7 +68,8 @@ { "name": "Number", "id": "Form_TestForm_Number", - "type": "Decimal", + "type": "number", + "schemaType": "Decimal", "component": null, "holderId": "Form_TestForm_Number_Holder", "title": "Number", @@ -87,7 +90,8 @@ { "name": "Money", "id": "Form_TestForm_Money", - "type": "Text", + "type": "text", + "schemaType": "Text", "component": null, "holderId": "Form_TestForm_Money_Holder", "title": "Money", @@ -108,7 +112,8 @@ { "name": "SecurityID", "id": "Form_TestForm_SecurityID", - "type": "Hidden", + "type": "hidden", + "schemaType": "Hidden", "component": null, "holderId": "Form_TestForm_SecurityID_Holder", "title": "Security ID", @@ -126,4 +131,4 @@ } ], "actions": [] -} \ No newline at end of file +}