Tagged: Code block, page builder
-
AuthorPosts
-
November 17, 2016 at 4:52 pm #713640
Hi,
I have been using enfold for lot of projects and have never seen anything like this.
One of our clients uses vTiger as a CRM and they offer up webforms to embed and generate leads and things. Once i copy the form and add it to the builder in enfold ether the text block or the code block it completley breaks the builder and makes it not so easy for updates to that page.
Have you had any issues with this before?
Here is the form.
<form id="__vtigerWebForm" action="https://caneanorthamerica.od2.vtiger.com/modules/Webforms/capture.php" method="post" accept-charset="utf-8" enctype="multipart/form-data"> <input type="hidden" name="__vtrftk" value="sid:f710df803429a339fdbf66c172df06345dcbf6b6,1478712447"> <input type="hidden" name="publicid" value="d15dd555fe94d683681c40fd69651b9b"> <input type="hidden" name="urlencodeenable" value="1"> <input type="hidden" name="name" value="CANEAONE_Leads"> <div class="half"> <label>First Name<span>*</span></label> <input type="text" name="firstname" data-label="" value="" required=""> </div> <div class="half"> <label>Last Name<span>*</span></label> <input type="text" name="lastname" data-label="" value="" required=""> </div> <div> <label>Company<span>*</span></label> <input type="text" name="company" data-label="" value="" required=""> </div> <div> <label>Title</label> <input type="text" name="designation" data-label="" value=""> </div> <div> <label>Primary Email<span>*</span></label> <input type="email" name="email" data-label="" value="" required=""> </div> <div> <label>Region<span>*</span></label> <select name="cf_1158" data-label="label:Region" required=""> <option value="">Select Value</option> <option value="Europe">Europe</option> <option value="Asia">Asia</option> <option value="North America">North America</option> <option value="South America">South America</option> <option value="Africa">Africa</option> <option value="Oceana">Oceana</option> </select> </div> <div> <label>Industry<span>*</span></label> <select name="industry" data-label="industry" required=""> <option value="">Select Value</option> <option value="Entertainment">Entertainment</option> <option value="Machinery">Machinery</option> <option value="Telecommunications">Telecommunications</option> <option value="Chemicals">Chemicals</option> <option value="Food & Beverage">Food & Beverage</option> <option value="Not For Profit">Not For Profit</option> <option value="Other">Other</option> <option value="Consulting">Consulting</option> <option value="Hospitality">Hospitality</option> <option value="Shipping">Shipping</option> <option value="Banking">Banking</option> <option value="Energy">Energy</option> <option value="Environmental">Environmental</option> <option value="Manufacturing">Manufacturing</option> <option value="Transportation">Transportation</option> <option value="Communications">Communications</option> <option value="Government">Government</option> <option value="Recreation">Recreation</option> <option value="Education">Education</option> <option value="Engineering">Engineering</option> <option value="Insurance">Insurance</option> <option value="Technology">Technology</option> <option value="Biotechnology">Biotechnology</option> <option value="Finance">Finance</option> <option value="Media">Media</option> <option value="Utilities">Utilities</option> <option value="Construction">Construction</option> <option value="Healthcare">Healthcare</option> <option value="Retail">Retail</option> <option value="Apparel">Apparel</option> <option value="Electronics">Electronics</option> <option value="Computer / Technology - Services">Computer / Technology - Services</option> <option value="Retail / Wholesale">Retail / Wholesale</option> <option value="Media / Marketing">Media / Marketing</option> <option value="Govenment - Local / State">Govenment - Local / State</option> <option value="Non Profit">Non Profit</option> <option value="Industrial Manufacturing">Industrial Manufacturing</option> <option value="Entertainment / Hospitality">Entertainment / Hospitality</option> <option value="Utility / Energy">Utility / Energy</option> <option value="Services">Services</option> <option value="Finance / Banking">Finance / Banking</option> <option value="Telecoms / Communication">Telecoms / Communication</option> <option value="Aviation / Aerospace">Aviation / Aerospace</option> <option value="Manufacturing - Non Computer Related">Manufacturing - Non Computer Related</option> <option value="Business Services - Non IT">Business Services - Non IT</option> <option value="Real Estate">Real Estate</option> <option value="Agriculture">Agriculture</option> <option value="Pharmaceutical">Pharmaceutical</option> <option value="Govenment - National / Federal">Govenment - National / Federal</option> <option value="Bio Technology">Bio Technology</option> <option value="Transportation / Distribution">Transportation / Distribution</option> </select> </div> <div> <label>Primary Phone<span>*</span></label> <input type="text" name="phone" data-label="" value="" required=""> </div> <div> <label>CANEA ONE Products<span>*</span></label> <select name="cf_1166[]" data-label="label:CANEA+ONE+Products" multiple="" style="width: 50%;" required=""> <option value="Strategy">Strategy</option> <option value="Process">Process</option> <option value="Project">Projects</option> <option value="Workflow">Workflow</option> <option value="Document">Document</option> </select> </div> <div> <label>Description</label> <textarea name="description"></textarea> </div> <div> <label>How did you hear about us?</label> <select name="leadsource" data-label="leadsource" hidden=""> <option value="">Select Value</option> <option value="Cold Call">Cold Call</option> <option value="Web Site" selected="">Web Site</option> <option value="Word of mouth">Word of mouth</option> <option value="Website">Website</option> <option value="Trade Show">Trade Show</option> <option value="Conference">Conference</option> <option value="Direct Mail">Direct Mail</option> <option value="Public Relations">Public Relations</option> <option value="Partner">Partner</option> <option value="Employee">Employee</option> <option value="Self Generated">Self Generated</option> <option value="Existing Customer">Existing Customer</option> <option value="Facebook">Facebook</option> <option value="Webinar">Webinar</option> </select> </div> <input type="submit" value="Submit" id="vtigerFormSubmitBtn"> </form> <script type="text/javascript"> window.onload = function() { var N=navigator.appName, ua=navigator.userAgent, tem;var M=ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];M=M? [M[1], M[2]]: [N, navigator.appVersion, "-?"];var browserName = M[0];var form = document.getElementById("__vtigerWebForm"), inputs = form.elements; form.onsubmit = function() { document.getElementById("vtigerFormSubmitBtn").disabled=true;var required = [], att, val; for (var i = 0; i < inputs.length; i++) { att = inputs[i].getAttribute("required"); val = inputs[i].value; type = inputs[i].type; if(type == "email") {if(val != "") {var elemLabel = inputs[i].getAttribute("label");var emailFilter = /^[_/a-zA-Z0-9]+([!"#$%&()*+,./:;<=>?\^_
{|}~-]?[a-zA-Z0-9/_/-])*@[a-zA-Z0-9]+([\_\-\.]?[a-zA-Z0-9]+)*\.([\-\_]?[a-zA-Z0-9])+(\.?[a-zA-Z0-9]+)?$/;var illegalChars= /[\(\)\<\>\,\;\:\”\[\]]/ ;if (!emailFilter.test(val)) {alert(“For “+ elemLabel +” field please enter valid email address”); document.getElementById(“vtigerFormSubmitBtn”).disabled=false; return false;} else if (val.match(illegalChars)) {alert(elemLabel +” field contains illegal characters”); document.getElementById(“vtigerFormSubmitBtn”).disabled=false; return false;}}}if (att != null) { if (val.replace(/^\s+|\s+$/g, “”) == “”) { required.push(inputs[i].getAttribute(“label”)); } } } if (required.length > 0) { alert(“The following fields are required: ” + required.join()); document.getElementById(“vtigerFormSubmitBtn”).disabled=false;return false; } var numberTypeInputs = document.querySelectorAll(“input[type=number]”);for (var i = 0; i < numberTypeInputs.length; i++) { val = numberTypeInputs[i].value;var elemLabel = numberTypeInputs[i].getAttribute(“label”);var elemDataType = numberTypeInputs[i].getAttribute(“datatype”);if(val != “”) {if(elemDataType == “double”) {var numRegex = /^[+-]?\d+(\.\d+)?$/;}else{var numRegex = /^[+-]?\d+$/;}if (!numRegex.test(val)) {alert(“For “+ elemLabel +” field please enter valid number”); document.getElementById(“vtigerFormSubmitBtn”).disabled=false; return false;}}}var dateTypeInputs = document.querySelectorAll(“input[type=date]”);for (var i = 0; i < dateTypeInputs.length; i++) {dateVal = dateTypeInputs[i].value;var elemLabel = dateTypeInputs[i].getAttribute(“label”);if(dateVal != “”) {var dateRegex = /^[1-9][0-9]{3}-(0[1-9]|1[0-2]|[1-9]{1})-(0[1-9]|[1-2][0-9]|3[0-1]|[1-9]{1})$/;if(!dateRegex.test(dateVal)) {alert(“For “+ elemLabel +” field please enter valid date in required format”); document.getElementById(“vtigerFormSubmitBtn”).disabled=false; return false;}}}var inputElems = document.getElementsByTagName(“input”);var totalFileSize = 0;for(var i = 0; i < inputElems.length; i++) {if(inputElems[i].type.toLowerCase() === “file”) {var file = inputElems[i].files[0];if(typeof file !== “undefined”) {var totalFileSize = totalFileSize + file.size;}}}if(totalFileSize > 52428800) {alert(“Maximum allowed file size including all files is 50MB.”);document.getElementById(“vtigerFormSubmitBtn”).disabled=false;return false;}var inputElem = document.querySelectorAll(“input[type=file]”);var fileSize = 0;for(var i = 0; i < inputElem.length; i++) {if(inputElem[i].type.toLowerCase() === “file”) {if(inputElem[i].hasAttribute(“selectedTypeImage”)) {var imageFile = inputElem[i].files[0];var fileSize = imageFile.size;}}if(fileSize > 5242880) {alert(“Maximum allowed image size is 5MB.”);document.getElementById(“vtigerFormSubmitBtn”).disabled=false;return false;}}}; }
</script>
`After saving the page the front end looks just fine but the back end is a mess when you go to that page.
Thanks
-DanNovember 21, 2016 at 1:21 pm #714794Hi acscreativenew!
The code you added seems to mess up your post here. Can you try to post the code in http://pastebin.com/index.php ?
I have checked the backend and can verify it’s messed up. I have removed it and it was fixed. Can you try adding the code in Appearance > Widgets, just create a new widget area and put the code in an html widget. Then in the page itself, use Widget Area in Advanced Layout Builder. Hope this helps. :)
Best regards,
NikkoNovember 28, 2016 at 7:12 pm #717931Hi Nikko,
The widget seems to work but just in case I have also posted the code here.
Let me know if you find anything.
November 28, 2016 at 8:02 pm #717943Hi!
Seems like you have found a workaround that I would like to suggest, using widget area (I checked you already made Contact Form widget area), I would suggest using it since it wouldn’t break the text editor. I found out that the problem is the textarea, if you remove the text area the backend wouldn’t be messed up, since the textarea is important, using code block or text block is not an option.
Best regards,
Nikko -
AuthorPosts
- You must be logged in to reply to this topic.