var link = document.createElement( "link" );
link.href = "https://unpkg.com/survey-core/survey-core.min.css";
link.type = "text/css";
link.rel = "stylesheet";
link.media = "screen,print";
document.getElementsByTagName("head")[0].appendChild( link );
const surveyJson = {
"title": "Hafðu samband",
"completedHtml": "
Takk fyrir að hafa samband. Erindi hefur verið stofnað hjá okkur
",
"loadingHtml": "Ræsi form...
",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "text",
"name": "firstname",
"title": "Nafn",
"isRequired": true
},
{
"type": "text",
"name": "kennitala",
"startWithNewLine": false,
"title": "Kennitala",
"validators": [
{
"type": "regex",
"text": "Vinsamlegast sláðu inn kennitölu"
}
],
"maxLength": 10
},
{
"type": "text",
"name": "emailaddress",
"title": "Netfang",
"isRequired": true,
"validators": [
{
"type": "email",
"text": "Sláðu inn gilt netfang"
}
],
"inputType": "email"
},
{
"type": "text",
"name": "mobilephone",
"startWithNewLine": false,
"title": "Símanúmer",
"validators": [
{
"type": "numeric"
}
],
"inputType": "tel"
},
{
"type": "text",
"name": "title",
"title": "Erindi (Stutt lýsing)",
"isRequired": true
},
{
"type": "comment",
"name": "message",
"title": "Skilaboð",
"isRequired": true
},
{
"type": "file",
"name": "Attachment",
"title": "Viðhengi (Hámarks stærð skjala er 28mb)",
"allowMultiple": true,
"maxSize": 30000000
}
]
}
],
"completeText": "Senda"
};
const survey = new Survey.Model(surveyJson);
survey.applyTheme({"themeName":"default","colorPalette":"light","isPanelless":false,"backgroundImage":"","backgroundImageFit":"cover","backgroundImageAttachment":"scroll","backgroundOpacity":1,"cssVariables":{"--sjs-font-family":"Avenir, 'Avenir Next', 'Segoe UI', Arial, sans-serif","--sjs-font-surveytitle-family":"Shape, Avenir, 'Segoe UI', Arial, sans-serif","--sjs-font-pagetitle-family":"Shape, Avenir, 'Segoe UI', Arial, sans-serif","--sjs-font-questiontitle-family":"Avenir, 'Avenir Next', 'Segoe UI', Arial, sans-serif","--sjs-general-backcolor":"rgba(254, 246, 241, 1)","--sjs-general-backcolor-dark":"rgba(247, 212, 193, 1)","--sjs-general-backcolor-dim":"rgba(251, 224, 209, 1)","--sjs-general-backcolor-dim-light":"rgba(253, 236, 226, 1)","--sjs-general-backcolor-dim-dark":"rgba(247, 212, 193, 1)","--sjs-general-forecolor":"rgba(44, 61, 116, 1)","--sjs-general-forecolor-light":"rgba(44, 61, 116, 0.55)","--sjs-general-dim-forecolor":"rgba(44, 61, 116, 1)","--sjs-general-dim-forecolor-light":"rgba(44, 61, 116, 0.55)","--sjs-primary-backcolor":"rgba(44, 61, 116, 1)","--sjs-primary-backcolor-light":"rgba(44, 61, 116, 0.08)","--sjs-primary-backcolor-dark":"rgba(33, 46, 90, 1)","--sjs-primary-forecolor":"rgba(255, 255, 255, 1)","--sjs-primary-forecolor-light":"rgba(255, 255, 255, 0.35)","--sjs-secondary-backcolor":"rgba(243, 179, 145, 1)","--sjs-secondary-backcolor-light":"rgba(243, 179, 145, 0.1)","--sjs-secondary-backcolor-semi-light":"rgba(243, 179, 145, 0.25)","--sjs-secondary-forecolor":"rgba(44, 61, 116, 1)","--sjs-secondary-forecolor-light":"rgba(44, 61, 116, 0.25)","--sjs-special-red":"rgba(229, 10, 62, 1)","--sjs-special-red-light":"rgba(229, 10, 62, 0.1)","--sjs-special-yellow":"rgba(243, 179, 145, 1)","--sjs-special-yellow-light":"rgba(243, 179, 145, 0.1)","--sjs-special-blue":"rgba(177, 214, 250, 1)","--sjs-special-blue-light":"rgba(177, 214, 250, 0.1)","--sjs-border-light":"rgba(44, 61, 116, 0.08)","--sjs-border-default":"rgba(44, 61, 116, 0.14)","--sjs-border-inside":"rgba(44, 61, 116, 0.14)","--sjs-corner-radius":"8px","--sjs-base-unit":"8px","--sjs-shadow-small":"0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs-shadow-small-reset":"0px 0px 0px 0px rgba(0, 0, 0, 0.15)","--sjs-shadow-medium":"0px 2px 6px 0px rgba(0, 0, 0, 0.1)","--sjs-shadow-large":"0px 8px 16px 0px rgba(0, 0, 0, 0.1)","--sjs-shadow-inner":"inset 0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs-shadow-inner-reset":"inset 0px 0px 0px 0px rgba(0, 0, 0, 0.15)","--sjs-article-font-xx-large-textDecoration":"none","--sjs-article-font-xx-large-fontWeight":"700","--sjs-article-font-xx-large-fontStyle":"normal","--sjs-article-font-xx-large-fontStretch":"normal","--sjs-article-font-xx-large-letterSpacing":"0","--sjs-article-font-xx-large-lineHeight":"64px","--sjs-article-font-xx-large-paragraphIndent":"0px","--sjs-article-font-xx-large-textCase":"none","--sjs-article-font-x-large-textDecoration":"none","--sjs-article-font-x-large-fontWeight":"700","--sjs-article-font-x-large-fontStyle":"normal","--sjs-article-font-x-large-fontStretch":"normal","--sjs-article-font-x-large-letterSpacing":"0","--sjs-article-font-x-large-lineHeight":"56px","--sjs-article-font-x-large-paragraphIndent":"0px","--sjs-article-font-x-large-textCase":"none","--sjs-article-font-large-textDecoration":"none","--sjs-article-font-large-fontWeight":"700","--sjs-article-font-large-fontStyle":"normal","--sjs-article-font-large-fontStretch":"normal","--sjs-article-font-large-letterSpacing":"0","--sjs-article-font-large-lineHeight":"40px","--sjs-article-font-large-paragraphIndent":"0px","--sjs-article-font-large-textCase":"none","--sjs-article-font-medium-textDecoration":"none","--sjs-article-font-medium-fontWeight":"700","--sjs-article-font-medium-fontStyle":"normal","--sjs-article-font-medium-fontStretch":"normal","--sjs-article-font-medium-letterSpacing":"0","--sjs-article-font-medium-lineHeight":"32px","--sjs-article-font-medium-paragraphIndent":"0px","--sjs-article-font-medium-textCase":"none","--sjs-article-font-default-textDecoration":"none","--sjs-article-font-default-fontWeight":"400","--sjs-article-font-default-fontStyle":"normal","--sjs-article-font-default-fontStretch":"normal","--sjs-article-font-default-letterSpacing":"0","--sjs-article-font-default-lineHeight":"28px","--sjs-article-font-default-paragraphIndent":"0px","--sjs-article-font-default-textCase":"none","--sjs2-color-bg-brand-primary":"rgba(44, 61, 116, 1)","--sjs2-color-bg-brand-primary-dim":"rgba(33, 46, 90, 1)","--sjs2-color-bg-brand-secondary":"rgba(44, 61, 116, 0.08)","--sjs2-color-fg-brand-primary":"rgba(44, 61, 116, 1)","--sjs2-color-fg-brand-primary-disabled":"rgba(255, 255, 255, 0.35)","--sjs2-color-fg-basic-primary":"rgba(44, 61, 116, 1)","--sjs2-color-fg-basic-secondary":"rgba(44, 61, 116, 0.55)","--sjs2-color-bg-basic-primary-dim":"rgba(253, 236, 226, 1)","--sjs2-color-bg-basic-secondary":"rgba(253, 236, 226, 1)","--sjs2-color-bg-basic-secondary-dim":"rgba(251, 224, 209, 1)","--sjs2-color-bg-neutral-tertiary-dim":"rgba(251, 224, 209, 1)","--sjs2-color-utility-sheet":"rgba(251, 224, 209, 1)","--sjs2-color-utility-surface-survey":"rgba(251, 224, 209, 1)","--sjs2-color-component-action-brand-tertiary-surface-hovered-bg":"rgba(253, 236, 226, 1)","--sjs2-color-component-action-alert-quaternary-surface-hovered-bg":"rgba(254, 246, 241, 1)","--sjs2-color-component-action-brand-quaternary-surface-hovered-bg":"rgba(254, 246, 241, 1)","--sjs2-color-component-action-neutral-quaternary-surface-hovered-bg":"rgba(254, 246, 241, 1)","--sjs2-color-component-action-alert-quaternary-surface-default-icon":"rgba(44, 61, 116, 0.55)","--sjs2-color-component-action-brand-quaternary-surface-default-icon":"rgba(44, 61, 116, 0.55)","--sjs2-color-component-action-neutral-quaternary-surface-default-icon":"rgba(44, 61, 116, 0.55)","--sjs2-color-component-tagbox-item-default-bg":"rgba(247, 212, 193, 1)","--sjs2-color-component-tagbox-item-hovered-bg":"rgba(243, 179, 145, 1)","--sjs2-color-component-tagbox-item-default-label":"rgba(44, 61, 116, 1)","--sjs2-color-component-tagbox-item-hovered-label":"rgba(44, 61, 116, 1)","--sjs2-color-component-tagbox-item-action-default-icon":"rgba(44, 61, 116, 1)","--sjs2-color-component-tagbox-item-action-hovered-icon":"rgba(44, 61, 116, 1)","--sjs2-color-component-tagbox-item-action-pressed-icon":"rgba(44, 61, 116, 1)","--sjs2-color-component-tagbox-item-action-hovered-bg":"rgba(255, 255, 255, 0.4)","--sjs2-radius-component-formbox":"8px","--sjs2-radius-component-action":"8px","--sjs2-border-effect-surface-default":"0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs2-border-effect-component-panel-default":"0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs2-border-effect-component-action-brand-tertiary-surface-default":"0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs2-border-effect-component-action-brand-tertiary-surface-hovered":"0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs2-border-effect-component-action-brand-tertiary-surface-disabled":"0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs2-border-effect-component-action-brand-primary-default":"0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs2-border-effect-component-action-brand-primary-hovered":"0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs2-border-effect-component-action-brand-primary-disabled":"0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs2-border-effect-floating-default":"0px 2px 6px 0px rgba(0, 0, 0, 0.1),0px 8px 16px 0px rgba(0, 0, 0, 0.1)","--sjs2-border-effect-component-formbox-default":"inset 0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs2-border-effect-component-formbox-hovered":"inset 0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs2-border-effect-component-checkbox-true-default":"inset 0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs2-border-effect-component-checkbox-false-default":"inset 0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs2-border-effect-component-radio-true-default":"inset 0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs2-border-effect-component-radio-false-default":"inset 0px 1px 2px 0px rgba(0, 0, 0, 0.15)","--sjs2-color-border-basic-secondary":"rgba(44, 61, 116, 0.08)","--sjs2-color-border-basic-secondary-overlay":"rgba(44, 61, 116, 0.14)","--sjs2-color-component-input-default-line":"rgba(44, 61, 116, 0.14)","--sjs2-typography-font-family-text":"Avenir, 'Avenir Next', 'Segoe UI', Arial, sans-serif","--sjs2-typography-font-family-component-page-title":"Shape, Avenir, 'Segoe UI', Arial, sans-serif","--sjs2-typography-font-family-component-question-title":"Avenir, 'Avenir Next', 'Segoe UI', Arial, sans-serif","--sjs2-color-bg-basic-primary":"rgba(254, 246, 241, 1)","--sjs2-color-utility-property-grid":"rgba(254, 246, 241, 1)","--sjs2-color-utility-tabs":"rgba(254, 246, 241, 1)","--sjs2-color-utility-toolbox":"rgba(254, 246, 241, 1)","--sjs2-color-bg-note-primary":"rgba(177, 214, 250, 1)","--sjs2-color-bg-note-secondary":"rgba(177, 214, 250, 0.1)","--sjs2-color-bg-warning-primary":"rgba(243, 179, 145, 1)","--sjs2-color-bg-warning-secondary":"rgba(243, 179, 145, 0.1)","--sjs2-color-project-brand-600":"rgba(44, 61, 116, 1)","--sjs2-typography-font-family-component-survey-header-title":"Shape, Avenir, 'Segoe UI', Arial, sans-serif"},"header":{"height":0,"mobileHeight":0,"inheritWidthFrom":"survey","textAreaWidth":0,"backgroundImageFit":"cover","backgroundImageOpacity":100,"overlapEnabled":false,"logoPositionX":"left","logoPositionY":"top","titlePositionX":"left","titlePositionY":"bottom","descriptionPositionX":"left","descriptionPositionY":"bottom"},"headerView":"basic"})
document.addEventListener("DOMContentLoaded", function() {
survey.render(document.getElementById("surveyContainer"));
});
survey.onComplete.add((sender, options) => {
const body = {
id: "4XnAzxJJShX9XRelKWgsm00y5JXlpM8OOpBZBtAzJfc=",
templateid : "07a3586b-02e4-f111-84e8-7c1e5234264e",
body: sender.data
}
fetch("https://arangoapi.azure-api.net/formbuilder/data", {
method: "POST",
body: JSON.stringify(body, null, 3),
headers: {
"Content-type": "application/json; charset=UTF-8",
"Ocp-Apim-Subscription-Key":"619f17719ac749d4b850d506db39ae98"
}
});
});