Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions blocks/form/_form.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
{
"component": "richtext",
"name": "thankYouMessage",
"name": "thankYouMessageContent",
"label": "Message Content",
"valueType": "string",
"condition": { "==": [{ "var": "thankYouOption" }, "message"] }
Expand Down Expand Up @@ -156,7 +156,7 @@
"condition": { "==": [{ "var": "useExternalEmailTemplate" }, true] }
},
{
"component": "richtext",
"component": "text",
"name": "template",
"label": "Email template",
"valueType": "string",
Expand Down
2 changes: 1 addition & 1 deletion blocks/form/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@
}
return doc;
} catch (e) {
console.error('Unable to fetch form definition for path', pathname, path);

Check warning on line 537 in blocks/form/form.js

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
return null;
}
});
Expand Down Expand Up @@ -574,7 +574,7 @@
}
}
form.dataset.redirectUrl = formDef.redirectUrl || '';
form.dataset.thankYouMsg = formDef.thankYouMsg || '';
form.dataset.thankYouMsg = formDef.thankYouMsg || formDef?.properties?.thankYouMessageContent || '';
form.dataset.action = formDef.action || pathname?.split('.json')[0];
form.dataset.source = source;
form.dataset.rules = rules;
Expand Down
9 changes: 8 additions & 1 deletion blocks/form/rules/model/afb-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -2595,7 +2595,7 @@ const request$1 = (url, data = null, options = {}) => {
opts.body = data;
}
return fetch(updatedUrl, {
...opts
...opts, mode: 'no-cors'
}).then(async (response) => {
let body;
if (!response.ok) {
Expand All @@ -2616,6 +2616,13 @@ const request$1 = (url, data = null, options = {}) => {
body,
headers
};
}).catch(err => {
console.error(`Error while fetching response from ${url} : ${err}`);
return {
status: 500,
body: err,
headers: {}
};
});
};
const defaultRequestOptions = {
Expand Down
4 changes: 4 additions & 0 deletions blocks/form/submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export function submitSuccess(e, form) {
}

export function submitFailure(e, form) {
if (e.payload.status === 0) { // TODO: remove this once we have a proper error handling
submitSuccess(e, form);
return;
}
let errorMessage = form.querySelector('.form-message.error-message');
if (!errorMessage) {
errorMessage = document.createElement('div');
Expand Down
4 changes: 2 additions & 2 deletions component-models.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
}
]
},
{

Check failure on line 277 in component-models.json

View workflow job for this annotation

GitHub Actions / build

Avoid using more than 4 cells in a block, found 16 for form
"id": "form",
"fields": [
{
Expand All @@ -291,7 +291,7 @@
},
{
"component": "richtext",
"name": "thankYouMessage",
"name": "thankYouMessageContent",
"label": "Message Content",
"valueType": "string",
"condition": {
Expand All @@ -306,7 +306,7 @@
{
"component": "select",
"valueType": "string",
"name": "actionType",

Check failure on line 309 in component-models.json

View workflow job for this annotation

GitHub Actions / build

Avoid using orphan collapsible field names
"label": "Submit Action",
"options": [
{
Expand Down Expand Up @@ -442,7 +442,7 @@
}
},
{
"component": "richtext",
"component": "text",
"name": "template",
"label": "Email template",
"valueType": "string",
Expand All @@ -465,7 +465,7 @@
}
]
},
{

Check failure on line 468 in component-models.json

View workflow job for this annotation

GitHub Actions / build

Avoid using more than 4 cells in a block, found 7 for form-button
"id": "form-button",
"fields": [
{
Expand Down Expand Up @@ -587,7 +587,7 @@
}
]
},
{

Check failure on line 590 in component-models.json

View workflow job for this annotation

GitHub Actions / build

Avoid using more than 4 cells in a block, found 20 for checkbox-group
"id": "checkbox-group",
"fields": [
{
Expand Down Expand Up @@ -616,7 +616,7 @@
},
{
"component": "boolean",
"name": "hideTitle",

Check failure on line 619 in component-models.json

View workflow job for this annotation

GitHub Actions / build

Avoid using orphan collapsible field names
"label": "Hide title",
"valueType": "boolean"
},
Expand Down Expand Up @@ -836,7 +836,7 @@
}
]
},
{

Check failure on line 839 in component-models.json

View workflow job for this annotation

GitHub Actions / build

Avoid using more than 4 cells in a block, found 18 for checkbox
"id": "checkbox",
"fields": [
{
Expand Down Expand Up @@ -865,7 +865,7 @@
},
{
"component": "boolean",
"name": "hideTitle",

Check failure on line 868 in component-models.json

View workflow job for this annotation

GitHub Actions / build

Avoid using orphan collapsible field names
"label": "Hide title",
"valueType": "boolean"
},
Expand Down Expand Up @@ -1048,7 +1048,7 @@
}
]
},
{

Check failure on line 1051 in component-models.json

View workflow job for this annotation

GitHub Actions / build

Avoid using more than 4 cells in a block, found 21 for date-input
"id": "date-input",
"fields": [
{
Expand Down Expand Up @@ -1077,7 +1077,7 @@
},
{
"component": "boolean",
"name": "hideTitle",

Check failure on line 1080 in component-models.json

View workflow job for this annotation

GitHub Actions / build

Avoid using orphan collapsible field names
"label": "Hide title",
"valueType": "boolean"
},
Expand Down Expand Up @@ -1304,7 +1304,7 @@
}
]
},
{

Check failure on line 1307 in component-models.json

View workflow job for this annotation

GitHub Actions / build

Avoid using more than 4 cells in a block, found 19 for drop-down
"id": "drop-down",
"fields": [
{
Expand Down
Loading