Click the fix button to fix each item. Remember to save your changes before running the audit again. If the highlighted issues are as you intended them to be, just click OK to dismiss the report.
The name attribute (` + $(this).attr("data-name") + `) used on this field is also used on other field(s). This is not an error but may not be what you intended. This is an advisory notice.
Note that this will be the evaluated when the form is first loaded. To set or change the value of `+ attribute+` during form completion, use Field Events.
Note that this will be the evaluated when the form is first loaded. To set or change the value of `+ attribute+` during form completion, use Field Events.
Note that this will be the evaluated when the form is first loaded. To set or change the value of `+ attribute+` during form completion, use Field Events.
Upload your form to formstrap. formstrap will host your form and process and store all form submissions. Various options are available for you to retrieve the data.
self-hosted
Download almost everything you need for the client-side to publish the form on your own website. You just need to handle the processing of the submitted form data.
Between 1p and 17p per form per day based on the number of active forms you have each day
Free! you can make an optional donation on the next page
or
Compare
create, edit and manage multiple forms at the same time
create one form at a time
formstrap hosts your forms at a custom URL: https://formstrap.com/yourcompany. you can download the forms too if you want to self-host
you publish the form on your website (client-side scripts and instructons provided)
edit live forms on the fly using the formstrap WYSIWYG editor
to edit live forms you need to edit the raw html provided in the download
formstrap processes the form and stores the submitted data in our UK datacentre even if you are self-hosting the client-side
you create your own server-side script to process submitted POST data
access to support
unlimited form submissions while forms are active
formstrap hosted forms are optionally protected from SPAM by Google reCAPTCHA v3
embedding - get a formstrap managed form with a seamless user experience
formstap can send an email confirmation to the person completing the form on successful submission
receive a PDF of the submitted form by email each time a form is submitted
log in to download the data for importing into excel, SPSS etc
analyse data using formstrap analytics (coming soon)
`);
$("#popupModal").modal("show");
}
function tour()
{
$("#popupModal").find(".modal-header").removeClass("d-none");
$("#popupModal").find(".modal-header").html(`
Paste or enter a 2 column, tab-delimited list below. The first column is the value that will be submitted. The second is the descriptive label.
If you are entering the list manually, the tab key functionality has been changed to allow tabs to be input. To move to the next field using the keyboard, press the tab key twice in succession.
You can also choose from lists created by formstrap or other users.
As a jobbing, self-taught developer who worked in the public and third sectors for longer than I care to mention, I developed a lot of bespoke browser-based, database-driven systems (e.g. client records systems, personnel management systems, intranets
etc).
These systems often required many forms so I developed a rudimentary, browser based editor to help me create, modify and deploy these forms quickly.
When I decided to give up the 9-to-5, I thought others may find such a system useful. formstrap was conceived. The idea has been completely reworked from scratch using Bootstrap 5.3, jQuery and jQuery-UI, PHP and MySQL. The editor mostly runs on the client (the earlier version made lots of server calls) so is quick and has a low impact on metered connections.
formstrap has no financial, legal or any other connection with Bootstrap. I just love the library and have been building browser-based applications using it for years.
This site uses an essential, first-party session cookie to maintain your session if and when you create an account and log in. A session cookie is also used when you preview your form to allow the preview page to access your form metadata without having to store it in the formstrap database. This information is immediately discarded from the server-side once the preview page is loaded.
No third party cookies are used.
The site uses your browser's local storage to store the form and its settings while you are using the editor. Data is also stored here to indicate you have clicked "OK" on this privacy policy; and also when you click to agree to the Terms of Use. By proceeding, you agree that the formstrap website can access, edit and delete formstrap data saved in your browser's local storage. Please note that formstrap cannot access local storage used by other websites.
The form design data saved in local storage is only sent in full to the formstrap server (UK datacentre) when you publish or preview the form. Once the self-host package or preview is completed, the data is discarded. When creating events, a server-side "helper" function is used but the data that is sent to it is not retained.
The formstrap "self-host" free service is offered "as-is" and is intended to be a helpful tool. It is offered with no warranty or guarantee of support.
By using this service you agree to indemnify formstrap and its owner against any negative outcome arising from the use a form you have created using the free "self-host" service.
You may use the formstrap editor as you wish - but your use must be fair and proportionate. The owner of formstrap reserves the right to withdraw the service if your use of the service has excessive or negative impact on the formstrap server(s) or other users.
The code and scripts that are provided when you download the self-hosting package are free from viruses, tracking scripts* or malicious code when they are delivered to you. Once you have the code you could modify it. Doing this might break the form or cause it to behave in a way not anticipated or intended by formstrap.
The form scripts provided do not contain advertising or promotional material except for a link at the bottom of the rendered form stating "made by formstrap" with a link to the formstrap website. You MAY remove this link if you wish by editing the index.html file in the package. Some of the scripts in the package are from third parties. The licence and copyright notices in these documents MUST be left intact when you publish the package on your own website. The readme.pdf document in the package provides more information about this.
"Self-hosted" forms are not saved to the formstrap servers. As such, it will not be possible for formstrap to recover your work if, for example, you delete the formstrap local storage from your device's browser. It is also not be possible for formstrap to assist you in transferring your work from one device to another. If you wish to do this please sign up for an account. Separate Terms of Use apply to account holders. You will be asked to agree to these terms if you decide to create an account.
* if you enable Google reCAPTCHA on your form then Google may store data or cookies on the devices of form users in order to provide the reCAPTCHA service.
CtrlAltF to edit form settings CtrlAltS to save form changes CtrlAltP to preview form
Click an element and then: CtrlAlt↑ to move it up CtrlAlt↓ to move it down CtrlAltM to view its metadata CtrlAltX to delete it CtrlAltC to clone it
Tooltips
You can get some help from the tooltips in the metadata forms for each component type.
You can also view the sample forms in the editor.
To view the metadata form, use your mouse to invoke the context menu (e.g. right button click) on the component you want to edit - or tap and hold on touch devices.
Registered users can submit support tickets.
`,null,function() { $("#offcanvascontext").find("i.fa-info-circle").removeClass("fa-bounce"); offcanvasList[0].hide();login(true) ; },function () { $("i.fa-info-circle").removeClass("fa-bounce"); },"Register","Close",null,"modal-lg",null,"green");
location.href="#popupmessage";
}
}
var conhtml;
var actionhtml;
var newee
function dosavetemplate(e,context,f)
{
event.preventDefault();
jsone={};
document.getElementById("templatename").setCustomValidity("");
if(f.checkValidity()==false)
{
if(document.getElementById("templatename").validity.valueMissing)
{
document.getElementById("templatename").setCustomValidity("Please provide a name for the template");
}
if(document.getElementById("templatename").validity.tooShort)
{
document.getElementById("templatename").setCustomValidity("The template name should be at least 10 characters long");
}
if(document.getElementById("templatename").validity.tooLong)
{
document.getElementById("templatename").setCustomValidity("The template name should a maximum of 150 characters long");
}
if(document.getElementById("templatename").validity.patternMismatch)
{
document.getElementById("templatename").setCustomValidity("Please use only letters, numbers and spaces.");
}
f.reportValidity();
return false;
}
var lookup={};
lookup["sectioncolumn"]="Section Column";
lookup["form"]="Form";
lookup["row"]="Row";
lookup["section"]="Section";
lookup["column"]="Column";
var sec,seccol,row,col,field;
field=$(e).closest(".form-group");
col=$(e).closest(".formcol");
prevcol=$(e).closest(".formcol").prevAll().length;
row=$(e).closest(".formrow");
prevrow=$(e).closest(".formrow").prevAll().length;
seccol=$(e).closest(".pagecol");
prevseccol=$(e).closest(".pagecol").prevAll().length;
sec=$(e).closest(".formpage");
prevsec=$(e).closest(".formpage").prevAll().length;
json=serialiseform();
if(context=="column")
{
jsone={"layout":
{
"Form":
{
"Sections":
[{"SectionColumns":
[{"Rows":
[{"RowColumns":
[json["layout"]["Form"]["Sections"][prevsec]["SectionColumns"][prevseccol]["Rows"][prevrow]["RowColumns"][prevcol]]
}]
}]
}]
}
},"fields":json["fields"],"events":json["events"]
}
jsone["fields"]=json["fields"];
}
else
{
if(context=="row")
{
jsone={"layout":
{
"Form":
{
"Sections":
[{"SectionColumns":
[{"Rows":[json["layout"]["Form"]["Sections"][prevsec]["SectionColumns"][prevseccol]["Rows"][prevrow]]
}]
}]
}
},"fields":json["fields"],"events":json["events"]
}
}
else
{
if(context=="sectioncolumn")
{
jsone={"layout":
{
"Form":
{
"Sections":
[{"SectionColumns":[json["layout"]["Form"]["Sections"][prevsec]["SectionColumns"][prevseccol]]
}]
}
},"fields":json["fields"],"events":json["events"]
}
}
else
{
if(context=="section")
{
jsone={"layout":
{
"Form":
{
"Sections":[json["layout"]["Form"]["Sections"][prevsec]["SectionColumns"][prevseccol]]
}
}
,"fields":json["fields"],"events":json["events"]
}
}
else
{
if(context="form")
{
jsone=json;
}
}
}
}
}
var post=$(f).serializeArray();
post.push({name:"HTML",value:$(e).prop("outerHTML")});
post.push({name:"Context",value:context});
post.push({name:"JSON",value:JSON.stringify(jsone)});
$.ajax({
url:"/scripts/savetemplate.php",
method:"POST",
data:post,
dataType:"json"
}).done(function(msg)
{
if(msg.response=="OK")
{
$('#messageModal').modal('hide');
setTimeout(function() {
messagepop("Your template has been saved.","circle-check");
},1000);
}
else
{
if(msg.response=="dup")
{
document.getElementById("templatename").setCustomValidity("This template name has already been used");
f.reportValidity();
return false;
}
else
{
$("#templatesaveerror").html(msg.response);
}
}
}).fail(function(e)
{
$("#templatesaveerror").html("There has been a fatal server error. The template could not be saved.
Please Try again Later");
});
}
function savetemplate(e,context)
{
if($("#mainlogout").length>0)
{
lookup={};
lookup["sectioncolumn"]="Section Column";
lookup["form"]="Form";
lookup["row"]="Row";
lookup["section"]="Section";
lookup["column"]="Column";
offcanvasList[0].hide();
messagepop(`
");
$("#savetemplate").on("click",function() { dosavetemplate(e,context,document.getElementById("template"));});
}
else
{
offcanvasList[0].hide();
messagepop(`Only logged in users can create templates.
Please register or login first`,`circle-xmark`);
}
}
function dosavetemplateold(e,context,f)
{
event.preventDefault();
document.getElementById("templatename").setCustomValidity("");
if(f.checkValidity()==false)
{
if(document.getElementById("templatename").validity.valueMissing)
{
document.getElementById("templatename").setCustomValidity("Please provide a name for the template");
}
if(document.getElementById("templatename").validity.tooShort)
{
document.getElementById("templatename").setCustomValidity("The template name should be at least 10 characters long");
}
if(document.getElementById("templatename").validity.tooLong)
{
document.getElementById("templatename").setCustomValidity("The template name should a maximum of 150 characters long");
}
if(document.getElementById("templatename").validity.patternMismatch)
{
document.getElementById("templatename").setCustomValidity("Please use only letters, numbers and spaces.");
}
f.reportValidity();
return false;
}
var post=$(f).serializeArray();
post.push({name:"HTML",value:$(e).prop("outerHTML")});
post.push({name:"Context",value:context});
$.ajax({
url:"/scripts/savetemplate.php",
method:"POST",
data:post,
dataType:"json"
}).done(function(msg)
{
if(msg.response=="OK")
{
$('#messageModal').modal('hide');
setTimeout(function() {
messagepop("Your template has been saved.","circle-check");
},1000);
}
else
{
if(msg.response=="dup")
{
document.getElementById("templatename").setCustomValidity("This template name has already been used");
f.reportValidity();
return false;
}
else
{
$("#templatesaveerror").html(msg.response);
}
}
}).fail(function(e)
{
$("#templatesaveerror").html("There has been a fatal server error. The template could not be saved.
Please Try again Later");
});
}
function viewtemplates(e,context)
{
offcanvasList[0].hide();
$.ajax({
method:"POST",
data:{context:context},
url:"/scripts/gettemplates.php",
dataType:"json"
}).done(function(msg)
{
if(msg.response=="OK")
{
$("#popupcon").find(".modal-header").removeClass("d-none");
$("#popupcon").find(".modal-title").html(`Choose a templateAdd to FORM`);
$("#popupdia").removeClass("modal-sm modal-md modal-lg modal-xl modal-xxl");
$("#popupdia").addClass("modal-xl");
$("#popupbod").html(msg.html);
$("#carouselExampleControls").find("input,select,textarea").attr("disabled",true);
$("#carouselExampleControls").find("a").off();
$("#carouselExampleControls").find("a").attr("onclick","");
$("#templatebutton").on("click",function() { usetemplate(e,context,$("#carouselExampleControls").find(".active").attr("id"));});
toolovers();
$("#popupbod").css("height","75vh");
$("#popupbod").css("overflow","auto");
$("#popupModal").modal("show");
$('.carousel').carousel();
}
else
{
messagepop(msg.error,"circle-exclamation");
}
});
}
function usetemplate(e,context,templateid)
{
$.ajax({
method:"POST",
url:"/scripts/gettemplate.php",
data:{id:templateid,context:context},
dataType:"json"
}
).done(function(msg)
{
$("#popupModal").modal("hide");
if(msg.response=="OK")
{
unselect();
$(e).find(".subcontainer").eq(0).append(msg.html);
newe=$(e).find(".subcontainer").eq(0).children().last();
newe=$(newe).find("div[id]").addBack();
renumbertemplate(newe,msg.json.events,msg.html);
}
});
}
function clone(e)
{
unselect();
newee=e;
$(e).after($(e).prop("outerHTML"));
newe=$(e).next();
cloned=$(newe).find("div[id]").addBack();
renumber(cloned,e);
}
function renumbertemplate(template,events,html)
{
types={};
oldids={};
types["form-group"]=parseInt($("#formcontainer").attr("data-field"));
types["formpage"]=parseInt($("#formcontainer").attr("data-sec"));
types["pagecol"]=parseInt($("#formcontainer").attr("data-pagecol"));
types["formrow"]=parseInt($("#formcontainer").attr("data-row"));
types["formcol"]=parseInt($("#formcontainer").attr("data-formcol"));
$.each(events,function(a,b) {
console.log(a);
console.log($(html));
if($(html).find(a).length==0 && $(html).find("[data-customclass='"+a.replace(".","") + "']").length==0)
{
delete events[a];
}
});
$(template).each(function() {
$(this).removeAttr("data-customid");
if($(this).hasClass("form-group"))
{
oid=$(this).attr("id");
types["form-group"]++;
oldids["#"+$(this).attr("id")]="#field"+types["form-group"];
$(this).attr("id","field"+types["form-group"]);
$(this).find("textarea,select,input").eq(0).attr("id","input-field"+types["form-group"]);
$(this).find("label").eq(0).attr("for","input-field"+types["form-group"]);
o=0;
$(this).find(".checks").find(".form-check").each(function()
{
$(this).find("input").attr("id","option-"+o+"-field"+types["form-group"]);
$(this).find("label").attr("for","option-"+o+"-field"+types["form-group"]);
o++;
});
}
if($(this).hasClass("formpage"))
{
types["formpage"]++;
oldids["#"+$(this).attr("id")]="#section"+types["formpage"];
$(this).attr("id","section"+types["formpage"]);
$(this).find("div.sectioncard").eq(0).attr("id","cardsection"+types["formpage"]);
}
if($(this).hasClass("pagecol"))
{
types["pagecol"]++;
oldids["#"+$(this).attr("id")]="#sectioncol"+types["pagecol"];
$(this).attr("id","sectioncol"+types["pagecol"]);
$(this).find("div.sectioncolumncard").eq(0).attr("id","cardpagecol"+types["pagecol"]);
}
if($(this).hasClass("formrow"))
{
types["formrow"]++;
oldids["#"+$(this).attr("id")]="#formrow"+types["formrow"];
$(this).attr("id","formrow"+types["formrow"]);
$(this).find("div.rowcard").eq(0).attr("id","cardformrow"+types["formrow"]);
}
if($(this).hasClass("formcol"))
{
types["formcol"]++;
oldids["#"+$(this).attr("id")]="#formcol"+types["formcol"];
$(this).attr("id","formcol"+types["formcol"]);
$(this).find("div.columncard").eq(0).attr("id","cardformcol"+types["formcol"]);
}
});
$("#formcontainer").attr("data-field",types["form-group"]);
$("#formcontainer").attr("data-sec",types["formpage"]);
$("#formcontainer").attr("data-pagecol",types["pagecol"]);
$("#formcontainer").attr("data-row",types["formrow"]);
$("#formcontainer").attr("data-formcol",types["formcol"]);
json=serialiseform();
if(json["events"])
{
events=Object.assign(events,json["events"]);
}
eventstext=replaceAll(JSON.stringify(events),oldids)
localStorage.setItem("events",(eventstext));
propagate(false,template);
dirty();
}
function renumber(cloned,e)
{
var json=serialiseform();
if(typeof newevents=="undefined")
{
var newevents={};
}
if(json["events"])
{
var events=json["events"];
}
else
{
events={};
}
var oid;
var replace={};
var types={};
types["form-group"]=parseInt($("#formcontainer").attr("data-field"));
types["formpage"]=parseInt($("#formcontainer").attr("data-sec"));
types["pagecol"]=parseInt($("#formcontainer").attr("data-pagecol"));
types["formrow"]=parseInt($("#formcontainer").attr("data-row"));
types["formcol"]=parseInt($("#formcontainer").attr("data-formcol"));
$(cloned).each(function() {
$(this).removeAttr("data-customid");
if($(this).hasClass("form-group"))
{
oid=$(this).attr("id");
types["form-group"]++;
$(this).attr("id","field"+types["form-group"]);
$(this).find("textarea,select,input").eq(0).attr("id","input-field"+types["form-group"]);
$(this).find("label").eq(0).attr("for","input-field"+types["form-group"]);
o=0;
$(this).find(".checks").find(".form-check").each(function()
{
$(this).find("input").attr("id","option-"+o+"-field"+types["form-group"]);
$(this).find("label").attr("for","option-"+o+"-field"+types["form-group"]);
o++;
});
if(json["events"])
{
if(json["events"]["#"+oid])
{
replace["#"+oid]="#field"+types["form-group"];
newevents["#field"+types["form-group"]]=json["events"]["#"+oid];
}
}
}
if($(this).hasClass("formpage"))
{
types["formpage"]++;
$(this).attr("id","section"+types["formpage"]);
$(this).find("div.sectioncard").eq(0).attr("id","cardsection"+types["formpage"]);
}
if($(this).hasClass("pagecol"))
{
types["pagecol"]++;
$(this).attr("id","sectioncol"+types["pagecol"]);
$(this).find("div.sectioncolumncard").eq(0).attr("id","cardpagecol"+types["pagecol"]);
}
if($(this).hasClass("formrow"))
{
types["formrow"]++;
$(this).attr("id","formrow"+types["formrow"]);
$(this).find("div.rowcard").eq(0).attr("id","cardformrow"+types["formrow"]);
}
if($(this).hasClass("formcol"))
{
types["formcol"]++;
$(this).attr("id","formcol"+types["formcol"]);
$(this).find("div.columncard").eq(0).attr("id","cardformcol"+types["formcol"]);
}
});
if($(newevents).length>0)
{
newevents=JSON.stringify(newevents);
newevents=replaceAll(newevents,replace);
newevents=JSON.parse(newevents);
events=Object.assign(events,newevents);
localStorage.setItem("events",JSON.stringify(events));
}
$("#formcontainer").attr("data-field",types["form-group"]);
$("#formcontainer").attr("data-sec",types["formpage"]);
$("#formcontainer").attr("data-pagecol",types["pagecol"]);
$("#formcontainer").attr("data-row",types["formrow"]);
$("#formcontainer").attr("data-formcol",types["formcol"]);
propagate(false,e);
dirty();
}
function replaceAll(string, replaceObj) {
return Object.keys(replaceObj).reduce(
(f, s, i) =>
`${f}`.replace(new RegExp(s, 'ig'), replaceObj[s]),
string
)
}
function normalise(e)
{
//
if($(e).hasClass("form-group"))
{
$(e).attr("id",e.id);
$(e).find("textarea,select,input").eq(0).attr("id","input-"+e.id);
$(e).find("label").eq(0).attr("for","input-"+e.id);
o=0;
$(e).find(".checks").find(".form-check").each(function()
{
$(this).find("input").attr("id","option-"+o+"-"+e.id);
$(this).find("label").attr("for","option-"+o+"-"+e.id);
o++;
});
}
if($(e).hasClass("formpage"))
{
$(e).attr("id",e.id)
$(e).find("div.sectioncard").eq(0).attr("id","card"+e.id);
}
if($(e).hasClass("pagecol"))
{
$(e).attr("id",e.id);
$(e).find("div.sectioncolumncard").eq(0).attr("id","card"+e.id);
}
if($(e).hasClass("formrow"))
{
$(e).attr("id",e.id);
$(e).find("div.rowcard").eq(0).attr("id","card"+e.id);
}
if($(e).hasClass("formcol"))
{
$(e).attr("id",e.id)
$(e).find("div.columncard").eq(0).attr("id","card"+e.id);
}
$(e).removeAttr("data-id");
}
function ticket()
{
document.getElementById("ticketsubject").setCustomValidity("");
$("#offcanvascontext").find("i.fa-info-circle").addClass("fa-bounce");
if(document.getElementById("checksession").value!="OK")
{
document.getElementById("ticketsubject").setCustomValidity("You are not logged in. Only logged in users may submit tickets.");
document.getElementById("ticketsubject").reportValidity();
return false;
}
if(document.getElementById("ticketsubject").validity.valid==false)
{
document.getElementById("ticketsubject").setCustomValidity("Please provide more information about the problem. The more info we have the more quickly we can help.");
document.getElementById("ticketsubject").reportValidity();
return false;
}
ticketdetail=document.getElementById("ticketsubject").value;
html="";
json="";
if($("#ticketsenddata").attr("checked")=="checked" && localStorage.getItem("formstrap")!=null)
{
html=localStorage.getItem("formstrap");
json=localStorage.getItem("formstrapjson");
}
$.ajax({
method:"POST",
url:"/scripts/saveticket.php",
data:{ticket:ticketdetail,html:html,json:json},
dataType:"json"
}).done(function(msg)
{
if(msg.response=="OK")
{
$("#messageModal").modal("hide");
setTimeout(function() { messagepop("Thank you for submitting a ticket.
Please check your email for confirmation and further information.
You can also view the status of the ticket in your dashboard.","ticket",null,null,null,null,null,null,null,"green"); } ,500);
}
else
{
$("#ticketerror").html("
To upload changes to your formstrap account, please login to your dashboard.","computer",function() { login() ;},function() { return false; },"Log In","Not Now");
}
else
{
messagepop("Changes to the form have been saved to your browser's local storage.
The URL will be retained as it is appreciated you may not have created the script yet.","bug") } else { messagepop("The URL provided returned an undefined error when a GET request was attempted. For more information, inspect the browser's console.
The URL will be retained as it is appreciated you may not have created the script yet.","bug"); } });
}
if(j=="posturl" && a.value!="")
{
if(a.validity.valid==false)
{
messagepop("The value entered is not a valid URL. Please provide the full URL including https://","exclamation-circle");
return false;
}
docheckurl("post",a.value).then((data) => { }).catch((error) => { if(error.status>0) { messagepop("The URL provided returned a "+ error.status + " error when a POST request was attempted.
The URL will be retained as it is appreciated you may not have created the script yet.","bug") } else { messagepop("The URL provided returned an undefined error when a POST request was attempted. For more information, inspect the browser's console.
The URL will be retained as it is appreciated you may not have created the script yet.","bug"); } });
}
if(j=="usspaces" && a.value!="")
{
a.value=a.value.replaceAll(" ","-").trim();
}
if(j=="whitespace" && a.value!="")
{
a.value=a.value.replaceAll(/[\n]+/g,"\n");
}
if(j=="tolower" && a.value!="")
{
a.value=a.value.toLocaleLowerCase();
}
if(j=="unique" && a.value!="")
{
if( $("#formcontainer").find("div["+attributes[0] +" ='"+a.value + "']").not($(b)).length>0)
{
messagepop("The value of "+ $(a).siblings("label").text() + " must be unique.
The value " + a.value + " is already in use on component #"+ $("#formcontainer").find("div["+attributes[0] +" ='"+a.value + "']").not($(b)).eq(0).attr("id") + "
Please try again","exclamation-circle");
$(a).val("");
return false;
}
}
if(j=="alphanum" && a.value!="")
{
var r=new RegExp(/^[a-zA-Z0-9-]+$/);
if(r.test(a.value)==false)
{
messagepop("Only letters, numbers and hyphens are permitted in " + $(a).siblings("label").text() + "
Invalid characters have been removed. Please check the santised entry.","exclamation-circle");
$(a).val( $(a).val().replace(/[^a-zA-Z0-9-]/g,"").trim() );
return false;
}
}
if(j=="regexp" && a.value!="")
{
try {
r=new RegExp(a.value,"v");
}
catch(err)
{
messagepop("The pattern entered could not be evaluated as a valid regular expression.
Please do not use delimiters. These are added automatically.
The pattern is compiled using the \"v\" flag. Get more information about how this influences how the pattern should be constructed.
`);
$.ajax({
method:"POST",
url:"/newform.php",
});
propagate(true);
countpages();
checksession();
dirty();
getcontext(document.getElementById("fullform"));
}
function download()
{
$("#popupModal").modal("hide");
json=JSON.parse(localStorage.getItem("formstrapjson"));
if(localStorage.getItem("selfhosttandc")==null)
{
messagepop("Please review the Terms of Use first","signature",function() { tandcpop() },function() { return false},"Terms of Use","Cancel");
return false;
}
if(json["layout"]["Form"]["SuccessURL"]=="" || typeof json["layout"]["Form"]["SuccessURL"]=="undefined")
{
messagepop("You must specify the URL the browser will redirect to when the form has successfully been submitted by the user.
Please do this first in Form Settings.","exclamation-circle",function() { getcontext(document.getElementById("fullform"));$("#popupModal").modal("hide");setTimeout(function() { $("#formcontextsuccessurl").focus(); },1000); },function() { return false; },"Settings","Cancel");
return false;
}
if(json["layout"]["Form"]["FailureURL"]=="" || typeof json["layout"]["Form"]["FailureURL"]=="undefined")
{
messagepop("You must specify the URL the browser will redirect to when the form submission is rejected by the server.
Please do this first in Form Settings.","exclamation-circle",function() { getcontext(document.getElementById("fullform"));$("#popupModal").modal("hide");setTimeout(function() { $("#formcontextfailureurl").focus(); },1000); },function() { return false; },"Settings","Cancel");
return false;
}
if(json["layout"]["Form"]["POSTURL"]=="" || typeof json["layout"]["Form"]["POSTURL"]=="undefined")
{
messagepop("You must specify the URL of the server-side script that will process the form submission.
Please do this first in Form Settings.","exclamation-circle",function() { getcontext(document.getElementById("fullform"));$("#popupModal").modal("hide");setTimeout(function() { $("#formcontextposturl").focus(); },1000); },function() { return false; },"Settings","Cancel");
return false;
}
if($("#formcontainer").find(".form-group").length==0)
{
messagepop("Your form has no fields","exclamation-circle");
return false;
}
if(localStorage.getItem("formstrapjson")=="")
{
messagepop("You have unsaved changes. Please save your form first","exclamation-circle");
return false;
}
if($("#formcontainer").attr("data-name")=="" || typeof $("#formcontainer").attr("data-name")=="undefined")
{
messagepop("You must give your form a name.
Please do this first in Form Settings.","exclamation-circle",function() { getcontext(document.getElementById("fullform"));$("#popupModal").modal("hide");setTimeout(function() { $("#formcontextname").focus(); },1000); },function() { return false; },"Settings","Cancel");
return false;
}
json=serialiseform();
$.ajax({
method:"post",
url:"/scripts/package.php",
dataType:"json",
data:{formdata:JSON.stringify(json)}
}).done(function(msg)
{
if(msg.response=="OK")
{
imagehtml="";
if(json["layout"]["Form"]["Heading"]["logo"]["src"])
{
filename=json["layout"]["Form"]["Heading"]["logo"]["src"].split("/");
imagehtml=`
`);
$("#popupdia").removeClass("modal-sm modal-md");
$("#popupdia").addClass("modal-lg");
i
$("#popupbod").html(`
A zip file has been downloaded to your computer.
This contains most of the files you need to publish your form. You need to create the script that processes the form and the pages for success/failure redirects.
The "readme.pdf" file provides more detail about each file and deployment instructions.
If you are unable to self-host the form please consider creating an acount or logging in and hosting with formstrap for a small "pay as you go" fee.
If you successfully self-host and are happy with the result please consider making an affordable donation to support the free self-hosting service. All contributions are very gratefully received.
What's in the zip file?
` + msg.filename + `
css
selfhost.css
font
EduVICWANTBeginner-Regular.ttf
OFL.txt
`+imagehtml+`
js
easing.js
events.js
selfhost.js
strtotime.js
favicon.png
form.html
index.html
readme.pdf
`);
setTimeout(function() { $("#popupModal").modal("show"); },1000);
toolovers();
}
else
{
messagepop("There was a problem creating your form","bug");
}
}).fail(function(msg)
{
messagepop("There was a problem creating your form","bug");
});
}
function donateoutcome(outcome,icon,colour)
{
messagepop(outcome,icon,null,null,null,null,null,null,null,colour);
}
function donate()
{
location.href="https://www.paypal.com/donate/?hosted_button_id=PAFGYQZ6AJM3A";
}
function paypaliframe()
{
if($("#donationce").val()<1)
{
$("#donateerror").html("The minimum donation that we can accept is £1.00");
$("#donationce").val("1");
$("#donationce").trigger("blur");
$("#donationce").focus();
return false;
}
$("#ganopay").prop("disabled",true);
$("#ganopay").html(` Creating PayPal Order`);
$.ajax({
method:"POST",
url:"/scripts/donate.php",
data:{amount:$("#donationce").val(),name:$("#donatename").val(),note:$("#donatenote").val(),fee:$("#feetick").prop("checked")},
dataType:"json"
}).done(function(msg)
{
if(msg.status=="PAYER_ACTION_REQUIRED")
{
$("#popupModal").find(".modal-header").html(`
Donation Order Created
`);
$("#popupbod").html(`
Your Donation Order has successfully been created by PayPal.
One off donation
£`+msg.amount+`
Total to be Paid
£`+msg.amount+`
Click the button below to visit PayPal and authorise the payment.
Please note you do not need to have a PayPal account to donate with PayPal.
`);
}
})
}
function formsettings()
{
unselect();
$("#offcanvascontext").removeClass("offcanvas-start");
$("#offcanvascontext").addClass("offcanvas-end");
$("#offcanvasevents").removeClass("offcanvas-start");
$("#offcanvasevents").addClass("offcanvas-end");
getcontext(document.getElementById("fullform"));
}
function viewdemo()
{
messagepop(`
The form will open in a new window or tab. It is a fully functioning, formstrap-hosted form. You can complete the form and the data you enter will be submitted. Please don\'t use real information (though if you want to see how the form-to-pdf function works you\'ll need to enter a real email address).
The form only works if accessed from the buttons below as a referrer restriction has been added to the form.
Do you want to proceed? You can choose to view an empty form or one that has been completed (the data is about a fictional person - any similarity to a real person is entirely coincidental).
`,`question-circle`,function() { getdemonodata(); },function() { getdemowithdata(); },`View Empty Form`,`View Completed Form`,true,`modal-md`,null,`green`,null,`primary`,`primary`);
}
function getdemowithdata()
{
$.ajax({
method:"POST",
url:"/scripts/sampledata.php",
dataType:"json"
}).done(function(msg) {
if(msg.response=="OK")
{
localStorage.setItem("demoapplication-data",msg.data);
window.open(`https://formstrap.com/samples/DemoForm`,`demo`);
}
});
}
function getdemonodata()
{
$.ajax({
method:"POST",
url:"/scripts/sampledata.php",
dataType:"json"
}).done(function(msg) {
if(msg.response=="OK")
{
localStorage.removeItem("demoapplication-data");
window.open(`https://formstrap.com/samples/DemoForm`,`demo`);
}
});
}
function getdemoform()
{
localStorage.removeItem("sampleform-data");
messagepop("The Demonstration Job Application Form will be loaded into the designer.
The form's metadata will be saved to your browser's local storage.
Are you sure you want to edit a fresh copy of the demo form?","circle-question",function() {
$.ajax({
method:"POST",
url:"/scripts/getdemo.php",
dataType:"json"
}).done(function(msg)
{
localStorage.setItem("formstrap",msg.HTML);
localStorage.setItem("formstrapjson",msg.JSON);
localStorage.setItem("name",msg.Name);
localStorage.setItem("events",msg.Events);
location.href="#"
location.reload();
});
},function() { return false; },"Yes","No",null,null,null,"green");
}
function getsamplerform()
{
localStorage.removeItem("sampleform-data");
messagepop("The Sampler Form will be loaded into the designer.
The form's metadata will be saved to your browser's local storage.