AnsweredAssumed Answered

Sending aikau form in json format

Question asked by hdalang on Oct 28, 2016
Latest reply on Oct 31, 2016 by ddraper

hey community, I want to use json format in sending data to alfresco so I have developed my form in aikau and I'm sending my data as webscript to some url defined before, the code of the form is shown here:

<code>

{

  name : "alfresco/forms/Form",

  config : {

  okButtonPublishTopic : "ALF_CRUD_CREATE",

  okButtonLabel : "Submit",

  showValidationErrorsImmediately : false,

  widgets : [

  {

  name : "alfresco/forms/controls/TextBox",

  config : {

  fieldId : "student-name",

  label : "Student Name",

  placeHolder : "Enter your name",

  name : "student-name",

  requirementConfig : {

  initialValue : true

  }

  }

  },

  {

  name : "alfresco/forms/controls/TextBox",

  config : {

  fieldId : "student-card-no",

  label : "Student Card Number",

  placeHolder : "Enter your card number",

  name : "student-card-no",

  type : "number",

  validationConfig : [ {

  "validation" : "regex",

  "regex" : "^[0-9]+$",

  "errorMessage" : "Numbers only"

  } ],

  requirementConfig : {

  initialValue : true,

  rules : [ {

  targetId : "SHOW",

  is : [ true ]

  } ]

  }

  }

  },

  {

  name : "alfresco/forms/controls/Select",

  config : {

  fieldId : "student-college",

  label : "Student College",

  name : "student-college",

  optionsConfig : {

  fixed : [ {

  label : "Faculty of Sharia",

  value : "FACULTY OF SHARIA"

  }, {

  label : "Faculty of Education",

  value : "FACULTY OF EDUCATION"

  }, {

  label : "Faculty of Arts",

  value : "FACULTY OF ARTS"

  }, {

  label : "Faculty of  Ecnomic",

  value : "FACULTY OF ECONOMIC"

  }, {

  label : "Faculty of Sciences",

  value : "FACULTY OF SCIENCES"

  }, {

  label : "Faculty of Computer",

  value : "FACULTY OF COMPUTER"

  }, {

  label : "Faculty of Engineering",

  value : "FACULTY OF ENGINEERING"

  }, {

  label : "Faculty of Medicine",

  value : "FACULTY OF MEDICINE"

  }, {

  label : "Faculty of Pharmcy",

  value : "FACULTY OF PHARMCY"

  }, {

  label : "Faculty of  Nursing",

  value : "FACULTY OF NURSING"

  }, {

  label : "Faculty of Oral",

  value : "FACULTY OF ORAL"

  }, {

  label : "Faculty of Metals",

  value : "FACULTY OF METALS"

  }, {

  label : "Faculty of Communications",

  value : "FACULTY OF COMMUNICATIONS"

  }, {

  label : "Faculty of  Laboratory",

  value : "FACULTY OF LABORATORY"

  }, {

  label : "Faculty of Islamicstudies",

  value : "FACULTY OF ISLAMICSTUDIES"

  }, {

  label : "Faculty of Agriculture",

  value : "FACULTY OF AGRICULTURE"

  } ]

  }

  }

  },

  {

  name : "alfresco/forms/controls/TextBox",

  config : {

  fieldId : "student-phone-no",

  label : "Student Phone Number",

  placeHolder : "Enter your phone number",

  name : "student-phone-no",

  requirementConfig : {

  initialValue : true

  },

  validationConfig : [ {

  "validation" : "regex",

  "regex" : "^[0-9]+$",

  "errorMessage" : "Numbers only"

  } ]

  }

  },

  {

  name : "alfresco/forms/controls/TextBox",

  config : {

  fieldId : "email",

  label : "Email",

  placeHolder : "Enter your email",

  name : "email",

  validationConfig : [ {

  validation : "regex",

  regex : "^([0-9a-zA-Z]([-.w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-w]*[0-9a-zA-Z].)+[a-zA-Z]{2,9})$",

  errorMessage : "Valid E-mail Address Required"

  } ],

  requirementConfig : {

  initialValue : true

  }

  }

  },

  {

  name : "alfresco/forms/controls/Select",

  config : {

  fieldId : "COUNTRY",

  label : "Country",

  description : "Select your Country",

  name : "country",

  optionsConfig : {

  fixed : [

  {

  label : "Afghanistan",

  value : "AFGHANISTAN"

  },

  {

  label : "Albania",

  value : "ALBANIA"

  },

  {

  label : "American Samoa",

  value : "AMERICAN SAMOA"

  },

  {

  label : "Andorra",

  value : "ANDORRA"

  },

  {

  label : "Angola",

  value : "ANGOLA"

  },

  {

  label : "Anguilla",

  value : "ANGUILLA"

  },

  {

  label : "Antarctica",

  value : "ANTARCTICA"

  },

  {

  label : "Antigua and Barbuda",

  value : "ANTIGUA AND BARBUDA"

  },

  {

  label : "Argentina",

  value : "ARGENTINA"

  },

  {

  label : "Armenia",

  value : "ARMENIA"

  },

  {

  label : "Aruba",

  value : "ARUBA"

  },

  {

  label : "Australia",

  value : "AUSTRALIA"

  },

  {

  label : "Austria",

  value : "AUSTRIA"

  },

  {

  label : "Azerbaijan",

  value : "AZERBAIJAN"

  },

  {

  label : "Bahamas",

  value : "BAHAMAS"

  },

  {

  label : "Bahrain",

  value : "BAHRAIN"

  },

  {

  label : "Bangladesh",

  value : "BANGLADESH"

  },

  {

  label : "Barbados",

  value : "BARBADOS"

  },

  {

  label : "Belarus",

  value : "BELARUS"

  },

  {

  label : "Belgium",

  value : "BELGIUM"

  },

  {

  label : "Belize",

  value : "BELIZE"

  },

  {

  label : "Benin",

  value : "BENIN"

  },

  {

  label : "Bermuda",

  value : "BERMUDA"

  },

  {

  label : "Bhutan",

  value : "BHUTAN"

  },

  {

  label : "Bolivia",

  value : "BOLIVIA"

  },

  {

  label : "Bosnia and Herzegovina",

  value : "BOSNIA AND HERZEGOVINA"

  },

  {

  label : "Botswana",

  value : "BOTSWANA"

  },

  {

  label : "Bouvet Island",

  value : "BOUVET ISLAND"

  },

  {

  label : "Brazil",

  value : "BRAZIL"

  },

  {

  label : "British Indian Ocean Territory",

  value : "BRITISH INDIAN OCEAN TERRITORY"

  },

  {

  label : "Brunei Darussalam",

  value : "BRUNEI DARUSSALAM"

  },

  {

  label : "Bulgaria",

  value : "BULGARIA"

  },

  {

  label : "Burkina Faso",

  value : "BURKINA FASO"

  },

  {

  label : "Burundi",

  value : "BURUNDI"

  },

  {

  label : "Cambodia",

  value : "CAMBODIA"

  },

  {

  label : "Canada",

  value : "CANADA"

  },

  {

  label : "Cape Verde",

  value : "CAPE VERDE"

  },

  {

  label : "Cayman Islands",

  value : "CAYMAN ISLANDS"

  },

  {

  label : "Central African Republic",

  value : "CENTRAL AFRICAN REPUBLIC"

  },

  {

  label : "Chad",

  value : "CHAD"

  },

  {

  label : "Chile",

  value : "CHILI"

  },

  {

  label : "China",

  value : "CHINA"

  },

  {

  label : "Christmas Island",

  value : "CHRISTMAS ISLAND"

  },

  {

  label : "Cocos (Keeling) Islands",

  value : "COCOS (KEELING) ISLANDS"

  },

  {

  label : "Colombia",

  value : "COLOMBIA"

  },

  {

  label : "Comoros",

  value : "COMOROS"

  },

  {

  label : "Congo",

  value : "CONGO"

  },

  {

  label : "The Democratic Republic of The Congo",

  value : "THE DEMOCRATIC REPUBLIC OF THE CONGO"

  },

  {

  label : "Cook Islands",

  value : "COOK ISLANDS"

  },

  {

  label : "Costa Rica",

  value : "COSTA RICA"

  },

  {

  label : "Cote D’ivoire",

  value : "COTE D’IVOIRE"

  },

  {

  label : "Croatia",

  value : "CROATIA"

  },

  {

  label : "Cuba",

  value : "CUBA"

  },

  {

  label : "Cyprus",

  value : "CYPRUS"

  },

  {

  label : "Czech Republic",

  value : "CZECH REPUBLIC"

  },

  {

  label : "Denmark",

  value : "DENMARK"

  },

  {

  label : "Djibouti",

  value : "DJIBOUTI"

  },

  {

  label : "Dominica",

  value : "DOMINICA"

  },

  {

  label : "Dominican Republic",

  value : "COOK ISLANDS"

  },

  {

  label : "Ecuador",

  value : "ECUADOR"

  },

  {

  label : "Egypt",

  value : "EGYPT"

  },

  {

  label : "El Salvador",

  value : "EL SALVADOR"

  },

  {

  label : "Equatorial Guinea",

  value : "EQUATORIAL GUINEA"

  },

  {

  label : "Eritrea",

  value : "ERITREA"

  },

  {

  label : "Estonia",

  value : "ESTONIA"

  },

  {

  label : "Ethiopia",

  value : "ETHIOPIA"

  },

  {

  label : "Falkland Islands (Malvinas)",

  value : "FALKLAND ISLANDS (MALVINAS)"

  },

  {

  label : "Faroe Islands",

  value : "FOROE ISLANDS"

  },

  {

  label : "Fiji",

  value : "Fiji"

  },

  {

  label : "Finland",

  value : "FINLAND"

  },

  {

  label : "French Guiana",

  value : "FRENCH GUIANA"

  },

  {

  label : "French Polynesia",

  value : "FRENCH POLYNESIA"

  },

  {

  label : "French Southern Territories",

  value : "FRENCH SOUTHERN TERRITORIES"

  },

  {

  label : "Gabon",

  value : "GABON"

  },

  {

  label : "Gambia",

  value : "GAMBIA"

  },

  {

  label : "Georgia",

  value : "GEORGIA"

  },

  {

  label : "Estonia",

  value : "ESTONIA"

  },

  {

  label : "Germany",

  value : "GERMANY"

  },

  {

  label : "Ghana",

  value : "GHANA"

  },

  {

  label : "Gibraltar",

  value : "GIBRALTAR"

  },

  {

  label : "Greece",

  value : "GREECE"

  },

  {

  label : "Greenland",

  value : "GREENLAND"

  },

  {

  label : "Grenada",

  value : "GRENADA"

  },

  {

  label : "Guadeloupe",

  value : "GUADELOUPE"

  },

  {

  label : "Guam",

  value : "GUAM"

  },

  {

  label : "Guatemala",

  value : "GUATEMALA"

  },

  {

  label : "Guinea",

  value : "GUINEA"

  },

  {

  label : "Guinea bissau",

  value : "GUINEA BISSAU"

  },

  {

  label : "Guyana",

  value : "GUYANA"

  },

  {

  label : "Haiti",

  value : "HAITI"

  },

  {

  label : "Heard Island and Mcdonald Islands",

  value : "HEARD ISLAND AND MCDONALD ISLANDS"

  },

  {

  label : "Holy See (Vatican City State)",

  value : "HOLY SEE(VATICAN CITY STATE)"

  },

  {

  label : "Honduras",

  value : "HONDURAS"

  },

  {

  label : "Hong Kong",

  value : "HONG KONG"

  },

  {

  label : "Hungary",

  value : "HUNGARY"

  },

  {

  label : "Iceland",

  value : "ICELAND"

  },

  {

  label : "India",

  value : "INDIA"

  },

  {

  label : "Indonesia",

  value : "INDONESIA"

  },

  {

  label : "Islamic Republic of Iran",

  value : "ISLAMIC REPUBLIC OF IRAN"

  },

  {

  label : "Iraq",

  value : "IRAQ"

  },

  {

  label : "Ireland",

  value : "IRELAND"

  },

  {

  label : "Israel",

  value : "ISRAEL"

  },

  {

  label : "Italy",

  value : "ITALY"

  },

  {

  label : "Jamaica",

  value : "JAMAICA"

  },

  {

  label : "Japan",

  value : "JAPAN"

  },

  {

  label : "Jordan",

  value : "JORDAN"

  },

  {

  label : "Kazakhstan",

  value : "KAZAKHSTAN"

  },

  {

  label : "Kenya",

  value : "KENYA"

  },

  {

  label : "Kiribati",

  value : "KIRIBATI"

  },

  {

  label : "Democratic People’s Republic of Korea",

  value : "DEMOCRATIC PEOPLE'S REPUBLIC OF KOREA"

  },

  {

  label : "Republic of Korea",

  value : "REPUBLIC OF KOREA"

  },

  {

  label : "Kuwait",

  value : "KUWAIT"

  },

  {

  label : "Kyrgyzstan",

  value : "KYRGYZSTAN"

  },

  {

  label : "Lao People’s Democratic Republic",

  value : "LEO PEOPLE'S DEMOCRATIC REPLUBLIC"

  },

  {

  label : "Latvia",

  value : "LATVIA"

  },

  {

  label : "Lebanon",

  value : "LEBANON"

  },

  {

  label : "Lesotho",

  value : "LESOTHO"

  },

  {

  label : "Liberia",

  value : "LIBERIA"

  },

  {

  label : "Libyan Arab Jamahiriya",

  value : "LIBYAN ARAB JAMAHIRIYA"

  },

  {

  label : "Liechtenstein",

  value : "LIECHTENSTEIN"

  },

  {

  label : "Lithuania",

  value : "LITHUANIA"

  },

  {

  label : "Luxembourg",

  value : "LUXEMBOURG"

  },

  {

  label : "Macao",

  value : "MACAO"

  },

  {

  label : "The Former Yugoslav Republic of Macedonia",

  value : "THE FORMER YUGOSLAV REPUBLIC OF MACEDONIA"

  },

  {

  label : "Madagascar",

  value : "MADAGASCAR"

  },

  {

  label : "Malawi",

  value : "MALAWI"

  },

  {

  label : "Malaysia",

  value : "MALAYSIA"

  },

  {

  label : "Maldives",

  value : "MALDIVES"

  },

  {

  label : "Mali",

  value : "MALI"

  },

  {

  label : "Malta",

  value : "MALTA"

  },

  {

  label : "Marshall Islands",

  value : "MARSHALL ISLANDS"

  },

  {

  label : "Martinique",

  value : "MARTINIQUE"

  },

  {

  label : "Mauritania",

  value : "MAURITANIA"

  },

  {

  label : "Mauritius",

  value : "MAURITIUS"

  },

  {

  label : "Mayotte",

  value : "MAYOTTE"

  },

  {

  label : "Mexico",

  value : "MEXICO"

  },

  {

  label : "Federated States of Micronesia",

  value : "FEDERATED STATES OF MICRONESIA"

  },

  {

  label : "Republic of Moldova",

  value : "REPUBLIC OF MOLDOVA"

  },

  {

  label : "Monaco",

  value : "MONACO"

  },

  {

  label : "Mongolia",

  value : "MONGOLIA"

  },

  {

  label : "Montserrat",

  value : "MONTSERRAT"

  },

  {

  label : "Morocco",

  value : "MOROCCO"

  },

  {

  label : "Mozambique",

  value : "MOZAMBIQUE"

  },

  {

  label : "Myanmar",

  value : "MYANMAR"

  },

  {

  label : "Namibia",

  value : "NAMIBIA"

  },

  {

  label : "Nauru",

  value : "NAURU"

  },

  {

  label : "Nepal",

  value : "NEPAL"

  },

  {

  label : "Netherlands",

  value : "NETHERLANDS"

  },

  {

  label : "Netherlands Antilles",

  value : "NETHERLANDS ANTILLES"

  },

  {

  label : "New Caledonia",

  value : "NEW CALENDONIA"

  },

  {

  label : "New Zealand",

  value : "NEW ZEALAND"

  },

  {

  label : "Nicaragua",

  value : "NICARAGUA"

  },

  {

  label : "Niger",

  value : "NIGER"

  },

  {

  label : "Nigeria",

  value : "NIGERIA"

  },

  {

  label : "Niue",

  value : "NIUE"

  },

  {

  label : "Norfolk Island",

  value : "NORFOLK ISLAND"

  },

  {

  label : "Northern Mariana Islands",

  value : "NORTHERN MARIANA ISLANDS"

  },

  {

  label : "Norway",

  value : "NORWAY"

  },

  {

  label : "Oman",

  value : "OMAN"

  },

  {

  label : "Pakistan",

  value : "PAKISTAN"

  },

  {

  label : "Palau",

  value : "PALAU"

  },

  {

  label : "Occupied Palestinian Territory",

  value : "OCCUPIED PALESTINIAN TERRITORY"

  },

  {

  label : "Panama",

  value : "PANAMA"

  },

  {

  label : "Papua New Guinea",

  value : "PAPUA NEW GUINEA"

  },

  {

  label : "Paraguay",

  value : "PARAGUAY"

  },

  {

  label : "Peru",

  value : "PERU"

  },

  {

  label : "Philippines",

  value : "PHILIPPINES"

  },

  {

  label : "Pitcairn",

  value : "PITCAIRN"

  },

  {

  label : "Poland",

  value : "POLAND"

  },

  {

  label : "Portugal",

  value : "PORTUGAL"

  },

  {

  label : "Puerto Rico",

  value : "PUERTO RICO"

  },

  {

  label : "Qatar",

  value : "QATAR"

  },

  {

  label : "Reunion",

  value : "REUNION"

  },

  {

  label : "Romania",

  value : "ROMANIA"

  },

  {

  label : "Russian Federation",

  value : "RUSSIAN FEDERATION"

  },

  {

  label : "Rwanda",

  value : "RWANDA"

  },

  {

  label : "Saint Helena",

  value : "SAINT HELENA"

  },

  {

  label : "Saint Kitts and Nevis",

  value : "SAINT KITTS AND NEVIS"

  },

  {

  label : "Saint Lucia",

  value : "SAINT LUCIA"

  },

  {

  label : "Saint Pierre and Miquelon",

  value : "SAINT PIERRE AND MIQUELON"

  },

  {

  label : "Saint Vincent and The Grenadines",

  value : "SAINT VINCENT AND THE GRENADINES"

  },

  {

  label : "Samoa",

  value : "SAMOA"

  },

  {

  label : "San Marino",

  value : "SAN MARINO"

  },

  {

  label : "Sao Tome and Principe",

  value : "SAO TOME AND PRINCIPE"

  },

  {

  label : "Saudi Arabia",

  value : "SAUDI ARABIA"

  },

  {

  label : "Senegal",

  value : "SENEGAL"

  },

  {

  label : "Serbia and Montenegro",

  value : "SERBIA AND MONTENEGRO"

  },

  {

  label : "Seychelles",

  value : "SEYCHELLES"

  },

  {

  label : "Sierra Leone",

  value : "SIERRA LEONE"

  },

  {

  label : "Singapore",

  value : "SINGAPORE"

  },

  {

  label : "Slovakia",

  value : "SLOVAKIA"

  },

  {

  label : "Slovenia",

  value : "SLOVIENIA"

  },

  {

  label : "Solomon Islands",

  value : "SOLOMON ISLANDS"

  },

  {

  label : "Somalia",

  value : "SOMALIA"

  },

  {

  label : "South Africa",

  value : "SOUTH AFRICA"

  },

  {

  label : "South Sudan",

  value : "SOUTH SUDAN"

  },

  {

  label : "South Georgia and The South Sandwich Islands",

  value : "SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS"

  },

  {

  label : "Spain",

  value : "SPAIN"

  },

  {

  label : "Sri Lanka",

  value : "SRI LANKA"

  },

  {

  label : "Sudan",

  value : "SUDAN"

  },

  {

  label : "Suriname",

  value : "SURINAME"

  },

  {

  label : "Svalbard and Jan Mayen",

  value : "SVALBARD AND JAN MAYEN"

  },

  {

  label : "Swaziland",

  value : "SWAZILAND"

  },

  {

  label : "Sweden",

  value : "SWEDEN"

  },

  {

  label : "Switzerland",

  value : "SWITZERLAND"

  },

  {

  label : "Syrian Arab Republic",

  value : "SYRIAN ARAB REPUBLIC"

  },

  {

  label : "Taiwan",

  value : "TAIWAN"

  },

  {

  label : "Tajikistan",

  value : "TAJIKISTAN"

  },

  {

  label : "United Republic of Tanzania",

  value : "UNITED REPUBLIC OF TANZANIA"

  },

  {

  label : "Thailand",

  value : "THAILAND"

  },

  {

  label : "Timor-Leste",

  value : "TIMOR-LESTE"

  },

  {

  label : "Togo",

  value : "TOGO"

  },

  {

  label : "Tokelau",

  value : "TOKELAU"

  },

  {

  label : "Tonga",

  value : "TONGA"

  },

  {

  label : "Trinidad and Tobago",

  value : "TRINIDAD AND TOBAGO"

  },

  {

  label : "Tunisia",

  value : "TUNISIA"

  },

  {

  label : "Turkey",

  value : "TURKEY"

  },

  {

  label : "Turkmenistan",

  value : "TURKMENISTAN"

  },

  {

  label : "Turks and Caicos Islands",

  value : "TURKS AND CAICOS ISLANDS"

  },

  {

  label : "Tuvalu",

  value : "TUVALU"

  },

  {

  label : "Uganda",

  value : "UGANDA"

  },

  {

  label : "Ukraine",

  value : "UKRAINE"

  },

  {

  label : "United Arab Emirates",

  value : "UNITED ARAB EMIRATES"

  },

  {

  label : "United Kingdom",

  value : "UNITED KINGDOM"

  },

  {

  label : "United States",

  value : "UNITED STATES"

  },

  {

  label : "United States Minor Outlying Islands",

  value : "UNITED STATES MINOR OUTLYING ISLANDS"

  }, {

  label : "Uruguay",

  value : "URUGUAY"

  }, {

  label : "Uzbekistan",

  value : "UZBEKISTAN"

  }, {

  label : "Vanuatu",

  value : "VANUATU"

  }, {

  label : "Venezuela",

  value : "VENEZUELA"

  }, {

  label : "Viet Nam",

  value : "VIET NAM"

  }, {

  label : "Virgin Islands, British",

  value : "VIRGIN ISLANDS, BRITISH"

  }, {

  label : "Virgin Islands, U.S.",

  value : "VIRGIN ISLANDS, U.S"

  }, {

  label : "Wallis and Futuna",

  value : "WALLIS AND FUTUNA"

  }, {

  label : "Western Sahara",

  value : "WESTER SAHARA"

  }, {

  label : "Yemen",

  value : "YEMEN"

  }, {

  label : "Zambia",

  value : "ZAMBIA"

  }, {

  label : "Zimbabwe",

  value : "ZIMBABWE"

  } ]

  }

  }

  }, {

  name : "alfresco/forms/controls/TextArea",

  config : {

  fieldId : "reason",

  label : "Description",

  description : "Describe your need",

  name : "reason",

  requirementConfig : {

  initialValue : true

  }

  }

  } ],

  okButtonPublishGlobal : true,

  okButtonPublishPayload : {

  url : "/hopenshare/student/apologycourse.json",

  },

  }

};

</code>

the form I want it in this format if it's possible:
<code>

{

     "studentName": "Testing form",

     "studentCardNo": 103255,

     "studentPhoneNo":0000000000,

     "studentCollege": "Arts",

     "email":"test@gmail.com",

     "date": "10/20/2006 12:00",

     "country": "Germany",

     "reason": 321321

}

</code>

Outcomes