Changeset 2570948
- Timestamp:
- 07/23/2021 01:31:02 PM (5 years ago)
- Location:
- easy-form-builder
- Files:
-
- 1 added
- 9 edited
-
tags/1.34.5 (added)
-
trunk/emsfb.php (modified) (1 diff)
-
trunk/includes/admin/assets/js/admin.js (modified) (6 diffs)
-
trunk/includes/admin/assets/js/core.js (modified) (2 diffs)
-
trunk/includes/admin/assets/js/list_form.js (modified) (2 diffs)
-
trunk/includes/admin/class-Emsfb-create.php (modified) (4 diffs)
-
trunk/includes/class-Emsfb-public.php (modified) (4 diffs)
-
trunk/public/assets/css/style.css (modified) (1 diff)
-
trunk/public/assets/js/core.js (modified) (23 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
easy-form-builder/trunk/emsfb.php
r2562277 r2570948 4 4 * Plugin URI: https://whitestudio.team 5 5 * Description: Easily create multi-step forms with tracking code support by using Easy Form Builder's drag & drop form wizard. This is the free version with limits. 6 * Version: 1.34. 46 * Version: 1.34.5 7 7 * Author: WhiteStudio 8 8 * Author URI: https://whitestudio.team -
easy-form-builder/trunk/includes/admin/assets/js/admin.js
r2562277 r2570948 396 396 function addOject_emsFormBuilder(id, id_, value, type, value_of, group, step) { 397 397 step = parseInt(step); 398 398 console.log(`id[${id}] id_[${id_}] value[${value}] type[${type}] value_of[${value_of}] group[${group}]`) 399 399 let highestAmount = group !== "option" ? Number(document.getElementById(`${id_}-amount`).value) : null; 400 400 highestAmount_emsFormBuilder = highestAmount; … … 405 405 if (group === "notOption") { 406 406 407 407 console.log(type) 408 408 if (value_of == "name") { 409 409 ob = { id_: id_, name: value, type: type, step: step, amount: highestAmount } … … 466 466 ob = fun_date_ob_pro_emsFormBuilder(id_, value, type, step, highestAmount) 467 467 } else if (type === "file") { 468 (value == null || value == undefined) && value.length > 2 ? value = 'Document' : 0;468 value = (value == null || value == undefined) && value.length > 2 ? 'Document' : value; 469 469 ob = { id_: id_, file: value, type: type, step: step, amount: highestAmount } 470 470 } … … 523 523 break; 524 524 case "file": 525 console.log(ob.file) 525 526 const file = { file: ob.file }; 526 527 valueJson_ws_p[foundIndex].file ? valueJson_ws_p[foundIndex].file = ob.file : valueJson_ws_p[foundIndex] = Object.assign(valueJson_ws_p[foundIndex], file); … … 648 649 //مقدار های عنوان و ایکون بعد از ساخت استپ ها وارد شود 649 650 } 651 console.log(v) 650 652 if (v.type != "option") { 651 653 … … 1666 1668 form_type_emsFormBuilder = "survey"; 1667 1669 formName_ws = form_type_emsFormBuilder 1668 /* const json =[{"steps":"1","name-1":efb_var.text.survey,"formName":efb_var.text.survey,"EfbVersion":1.3,"type":"survey","icon-1":"fa fa-bell"}]; 1670 const json =[{"steps":"1","name-1":efb_var.text.survey,"formName":efb_var.text.survey,"EfbVersion":1.3,"type":"survey","icon-1":"fa fa-bell"},{"id_":"a1ssso13a","name":"What is your favorite color ?","type":"radiobutton","step":1,"amount":1,"required":true},{"id_":"64xmuzowk","name":"Blue","parents":"a1ssso13a","type":"option","step":null},{"id_":"kgy5ezwda","name":"Green","parents":"a1ssso13a","type":"option","step":null},{"id_":"uceyp8e9i","name":"Red","parents":"a1ssso13a","type":"option","step":null},{"id_":"m78afg3gl","name":"Black","parents":"a1ssso13a","type":"option","step":null},{"id_":"hj1t2ehe2","name":"White","parents":"a1ssso13a","type":"option","step":null}]; 1671 1669 1672 localStorage.setItem('valueJson_ws_p', JSON.stringify(json)) 1670 valueJson_ws_p =json; */ 1673 valueJson_ws_p =json; 1674 1671 1675 1672 1676 } else if (id == "reservation") { -
easy-form-builder/trunk/includes/admin/assets/js/core.js
r2556411 r2570948 86 86 let acception =`.zip,.rar`; 87 87 let typeFile ="Zip" 88 88 89 if(v.file=="Image"){ 89 90 acception =`.png,.jpg,.jpeg`; … … 330 331 value = input.value 331 332 } 332 //console.log(input.type , 789999);333 // console.log(input.type ,input.tagName , 789999); 333 334 switch(input.type){ 334 335 case 'email': -
easy-form-builder/trunk/includes/admin/assets/js/list_form.js
r2562277 r2570948 183 183 const msg_id = valueJson_ws_messages[indx].msg_id; 184 184 //console.l(valueJson_ws_messages[indx],msg_id); 185 185 186 186 const userIp = valueJson_ws_messages[indx].ip; 187 187 const track = valueJson_ws_messages[indx].track; 188 188 const date = valueJson_ws_messages[indx].date; 189 189 190 190 const content = JSON.parse(valueJson_ws_messages[indx].content.replace(/[\\]/g, '')); 191 console.log(content) 191 192 192 193 let by = valueJson_ws_messages[indx].read_by !== null ? valueJson_ws_messages[indx].read_by : "Unkown" … … 194 195 const m = fun_emsFormBuilder_show_messages(content, by, userIp, track, date) 195 196 //reply message ui 196 197 197 198 198 199 form_type_emsFormBuilder = formType; -
easy-form-builder/trunk/includes/admin/class-Emsfb-create.php
r2562277 r2570948 34 34 35 35 add_action( 'admin_menu', array( $this, 'add_Create_menu' ), 11 ); 36 add_action( 'admin_create_scripts', array( $this, 'admin_create_scripts' ) );37 add_action( 'admin_init', array( $this, 'register_create' ) );38 add_action('fun_Emsfb_creator', array( $this, 'fun_Emsfb_creator'));36 // add_action( 'admin_create_scripts', array( $this, 'admin_create_scripts' ) ); 37 // add_action( 'admin_init', array( $this, 'register_create' ) ); 38 39 39 add_action('wp_ajax_add_form_Emsfb', array( $this,'add_form_structure')); 40 40 … … 64 64 65 65 66 /* 66 67 public function register_create() { 67 68 … … 71 72 72 73 73 } 74 } */ 74 75 75 76 … … 293 294 } 294 295 295 public function fun_Emsfb_creator() 296 { 297 298 } 296 299 297 300 298 public function add_form_structure(){ -
easy-form-builder/trunk/includes/class-Emsfb-public.php
r2562277 r2570948 114 114 "DragAndDropA" => __('Drag and drop a','easy-form-builder'), 115 115 "youNotPermissionUploadFile" => __('You do not have permission to upload this file:','easy-form-builder'), 116 "trackingForm" => __('Tracking Form','easy-form-builder'), 116 117 "pleaseUploadA" => __('Please upload a','easy-form-builder'), 117 " trackingForm" => __('Tracking Form','easy-form-builder'),118 "pleaseUploadAFILE" => __('Please upload a file','easy-form-builder'), 118 119 "trackingCodeIsNotValid" => __('Tracking Code is not valid.','easy-form-builder'), 119 120 "checkedBoxIANotRobot" => __('Please Checked Box of I am Not robot','easy-form-builder'), … … 146 147 "subscribe" => __('Subscribe','easy-form-builder'), 147 148 "contactUs" => __('Contact us','easy-form-builder'), 148 "support" => __('Support','easy-form-builder'), 149 "send" => __('Send','easy-form-builder'), 149 "support" => __('Support','easy-form-builder'), 150 150 "register" => __('Register','easy-form-builder'), 151 151 "passwordRecovery" => __('Password recovery','easy-form-builder'), 152 "info" => __('information'), 152 "date" => __('Date','easy-form-builder'), 153 "info" => __('Info','easy-form-builder'), 154 "response" => __('Response','easy-form-builder'), 153 155 "areYouSureYouWantDeleteItem" => __('Are you sure want to delete this item?','easy-form-builder'), 154 156 "noComment" => __('No comment','easy-form-builder'), 155 157 "waitingLoadingRecaptcha" => __('Waiting for loading recaptcha','easy-form-builder'), 158 "by" => __('By','easy-form-builder'), 156 159 "please" => __('Please','easy-form-builder') 157 160 ]; … … 246 249 "waitingLoadingRecaptcha" => __('Waiting for loading recaptcha','easy-form-builder'), 247 250 "sync" => __('Sync','easy-form-builder'), 251 "date" => __('Date','easy-form-builder'), 252 "info" => __('Info','easy-form-builder'), 253 "reply" => __('Reply','easy-form-builder'), 254 "send" => __('Send','easy-form-builder'), 255 "by" => __('By','easy-form-builder'), 256 "response" => __('Response','easy-form-builder'), 248 257 "please" => __('Please','easy-form-builder'), 249 258 … … 895 904 // تنظیمات امنیتی بعدا اضافه شود که فایل از مسیر کانت که عمومی هست جابجا شود به مسیر دیگری 896 905 //error_log($_FILES["file"]["name"]); 897 $name = 'e msfb-PLG-'. date("ymd"). '-'.substr(str_shuffle("0123456789ASDFGHJKLQWERTYUIOPZXCVBNM"), 0, 8).'.'.pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION) ;906 $name = 'efb-PLG-'. date("ymd"). '-'.substr(str_shuffle("0123456789ASDFGHJKLQWERTYUIOPZXCVBNM"), 0, 8).'.'.pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION) ; 898 907 //error_log($name); 899 908 $upload = wp_upload_bits($name, null, file_get_contents($_FILES["file"]["tmp_name"])); 900 909 //$upload = wp_upload_bits($_FILES["file"]["name"], null, file_get_contents($_FILES["file"]["tmp_name"])); 901 910 //$upload['url'] will gives you uploaded file path 902 $response = array( 'success' => true ,'ID'=>"id" , "file"=>$upload , 'type'=>$_FILES['file']['type']); 911 //error_log($upload); 912 $response = array( 'success' => true ,'ID'=>"id" , "file"=>$upload ,"name"=>$name ,'type'=>$_FILES['file']['type']); 903 913 wp_send_json_success($response,$_POST); 904 914 }else{ -
easy-form-builder/trunk/public/assets/css/style.css
r2562277 r2570948 46 46 47 47 input.invalid.emsFormBuilder , 48 label.invalid.emsFormBuilder { 49 border: 1px solid #e03a0666!important; 50 background: antiquewhite; 48 label.invalid.emsFormBuilder , 49 textarea.invalid.emsFormBuilder , 50 select.invalid.emsFormBuilder { 51 border: 1px solid #e00606d9!important; 52 background: rgba(252, 107, 107, 0.472); 51 53 } 52 54 -
easy-form-builder/trunk/public/assets/js/core.js
r2562277 r2570948 364 364 console.log(valueJson_ws[0].steps); */ 365 365 for (let v of valueJson_ws) { 366 366 367 367 let el=""; 368 368 let id; … … 462 462 case 'checkbox': 463 463 case 'radiobutton': 464 465 464 466 id = v.id ? v.id : v.id_; 465 467 const typ = v.type == "checkbox" ? "checkbox" : "radio"; 466 468 req = v.required ? v.required : false; 467 console.log(v.type , "required");469 468 470 const m = v.type =="radiobutton" ? "m-2" : ''; 469 471 el = `<div class=" emsFormBuilder"><div class="row ${m}"><label for="${v.id_}" id="${v.id_}" class="emsFormBuilder emsFormBuilder-title ${v.required == true ? 'require' : ''}" data-id="${v.id_}" >${v.name} ${v.required == true ? '*' : ''}</label></div>` … … 487 489 } 488 490 el +=`<small class="text-danger" id="${v.id_}-message"></small>`; 489 491 490 492 exportView_emsFormBuilder.push({id_:v.id_, element: el, step: v.step, amount: v.amount, parents: v.id_, type: 'select', required: req, amount:v.amount ,multiselect:multiSelect}); 491 493 break … … 496 498 if (indx > -1){ 497 499 req = (exportView_emsFormBuilder[indx].required && exportView_emsFormBuilder[indx].required != undefined )? exportView_emsFormBuilder[indx].required : false; 498 //console.log(`req ${req}`, exportView_emsFormBuilder[indx].required, exportView_emsFormBuilder[indx]) 499 //console.log(indx, exportView_emsFormBuilder[indx]); 500 if (exportView_emsFormBuilder[indx].type == "radio" || exportView_emsFormBuilder[indx].type == "checkbox") exportView_emsFormBuilder[indx].element += `<div class="row emsFormBuilder"><div class="emsFormBuilder_option col-1"><input type="${exportView_emsFormBuilder[indx].type}" id='${id}' name="${v.parents}" class="${v.class ? `${v.class} emsFormBuilder_v col` : `emsFormBuilder emsFormBuilder_v`} ${req == true ? 'require' : ''}" value="${v.name}" ${v.tooltip ? `placeholder=${v.tooltip}` : ''} data-id="${v.id_}"}></div> <div class="col-10 emsFormBuilder_option"><label for="${v.parents}" class="emsFormBuilder" >${v.name}</label></div></div>` 500 501 if (exportView_emsFormBuilder[indx].type == "radio" || exportView_emsFormBuilder[indx].type == "checkbox") exportView_emsFormBuilder[indx].element += `<div class="row emsFormBuilder"><div class="emsFormBuilder_option col-1"><input type="${exportView_emsFormBuilder[indx].type}" id='${id}' name="${v.parents}" class="${v.class ? `${v.class} emsFormBuilder_v col` : `emsFormBuilder emsFormBuilder_v`} ${req == true ? 'require' : ''}" value="${v.name}" ${v.tooltip ? `placeholder=${v.tooltip}` : ''} data-id="${v.id_}"}></div> <div class="col-10 emsFormBuilder_option"><label for="${id}" class="emsFormBuilder" >${v.name}</label></div></div>` 501 502 502 // if (exportView_emsFormBuilder[indx].type == "select") exportView_emsFormBuilder[indx].element += `<option id='${id}' class="${v.class ? `${v.class}` : `emsFormBuilder `} ${req == true ? 'require' : ''}" value="${v.name}" name="${v.parents}" value="${v.name}" data-id="${v.id_}">${v.name}</option>`503 503 504 if (exportView_emsFormBuilder[indx].type == "select" && exportView_emsFormBuilder[indx].multiselect==false) { 504 console.log(exportView_emsFormBuilder[indx].element.includes("<option") ) 505 console.log(exportView_emsFormBuilder[indx]) 505 506 506 if (!exportView_emsFormBuilder[indx].element.includes("<option") ) { 507 exportView_emsFormBuilder[indx].element += ` <option style="display:none" >Select an option</option>`;507 exportView_emsFormBuilder[indx].element += ` <option style="display:none" value="">Select an option</option>`; 508 508 } 509 509 exportView_emsFormBuilder[indx].element += `<option id='${id}' class="${v.class ? `${v.class}` : `emsFormBuilder `} ${req == true ? 'require' : ''}" value="${v.name}" name="${v.parents}" data-id="${v.id_}">${v.name}</option>`; … … 552 552 <!-- recaptcha end --> 553 553 554 ${valueJson_ws[0].steps>1 ?` <div style="float:right;"> <button type="button" id="emsFormBuilder-text-prevBtn-view" class="emsformbuilder" class="mat-shadow emsFormBuilder" onclick="emsFormBuilder_nevButton_view(-1)"><i class="${ajax_object_efm.rtl==1 ? 'fa fa-angle-double-right' :'fa fa-angle-double-left'}"></i></button> <button type="button" id="emsFormBuilder-text-nextBtn-view " class="mat-shadow emsFormBuilder" onclick="emsFormBuilder_nevButton_view(1)"><i class="${ajax_object_efm.rtl==1 ? 'fa fa-angle-double-left' :'fa fa-angle-double-right'}"></i></button> </div> ` :`<button type="button" id="emsFormBuilder-text-nextBtn-view" class="btn btn-lg btn-block mat-shadow-efb btn-type-efb btn-lg-efb " onclick="emsFormBuilder_nevButton_view(1)">${button_name} </button> </div> ` }554 ${valueJson_ws[0].steps>1 ?` <div style="float:right;"> <button type="button" id="emsFormBuilder-text-prevBtn-view" class="emsformbuilder" class="mat-shadow emsFormBuilder" onclick="emsFormBuilder_nevButton_view(-1)"><i class="${ajax_object_efm.rtl==1 ? 'fa fa-angle-double-right' :'fa fa-angle-double-left'}"></i></button> <button type="button" id="emsFormBuilder-text-nextBtn-view" class="mat-shadow emsFormBuilder" onclick="emsFormBuilder_nevButton_view(1)"><i class="${ajax_object_efm.rtl==1 ? 'fa fa-angle-double-left' :'fa fa-angle-double-right'}"></i></button> </div> ` :`<button type="button" id="emsFormBuilder-text-nextBtn-view" class="btn btn-lg btn-block mat-shadow-efb btn-type-efb btn-lg-efb " onclick="emsFormBuilder_nevButton_view(1)">${button_name} </button> </div> ` } 555 555 </div> 556 556 </form> … … 602 602 } 603 603 } 604 605 606 607 608 604 } 609 605 … … 646 642 // if(!grecaptcha.getResponse()){document.getElementById('recaptcha-message').innerHTML=ajax_object_efm.text.errorVerifyingRecaptcha;} 647 643 const response = sitekye_emsFormBuilder ? grecaptcha.getResponse() || null : 'not'; 648 console.log(`[${response}]` ,sitekye_emsFormBuilder)649 644 if( response!=null) { 650 645 //reCaptcha not verified … … 667 662 if (n != 0) { 668 663 var x = document.getElementsByClassName("emsFormBuilder-tab-view"); 669 if (n == 1 && !validateForm_emsFormBuilder_view()) return false; 664 console.log(n); 665 if (n == 1 && !validateForm_emsFormBuilder_view()) { 666 console.log('return false'); 667 return false; 668 } 670 669 x[currentTab_emsFormBuilder].style.display = "none"; 671 670 currentTab_emsFormBuilder = currentTab_emsFormBuilder + n; … … 713 712 function validateForm_emsFormBuilder_view() { 714 713 let x, y, i, valid = true , NotValidCount=0; 715 //console.log('validateForm_emsFormBuilder_view');714 // console.log('validateForm_emsFormBuilder_view'); 716 715 x = document.getElementsByClassName("emsFormBuilder-tab-view"); 717 716 y = x[currentTab_emsFormBuilder].querySelectorAll(".require"); 718 let value 717 let value = null; 719 718 try { 719 // console.log(x[currentTab_emsFormBuilder].querySelectorAll(".require , .validation")); 720 720 for (const input of x[currentTab_emsFormBuilder].querySelectorAll(".require , .validation")) { 721 //require 722 //console.log(`type[${el.type}]`); 723 const req =input.classList.contains('require'); 724 if (input.tagName == "INPUT") { 725 if (input.value == "" && input.classList.contains('require')) { 726 input.className += " invalid"; valid = false; 727 } else { 728 input.classList.remove('invalid'); 729 value = input.value 730 } 731 //console.log(input.type , 789999); 732 switch(input.type){ 733 case 'email': 734 req===true ? valid= valid_email_emsFormBuilder(input) : valid=true; 735 break; 736 case 'tel': 737 //console.log('707 tel' , req , req===true ,input.classList) 738 req===true ? valid= valid_phone_emsFormBuilder(input) : valid=true; 739 break; 740 case 'password': 741 req===true ? valid= valid_password_emsFormBuilder(input) : valid=true; 742 break; 743 case "range": 744 value = el.value; 745 break; 746 case 'url': 747 const check = input.value.match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g); 748 if (check===null && input.classList.contains('require')==true){ 749 //console.log(check ,999) 750 valid=false; 751 input.className += ' invalid'; 752 document.getElementById(`${input.id}-row`).innerHTML +=`<small class="text-danger" id="${input.id}-message">${ajax_object_efm.text.enterٰValidURL}</small>` 753 }else{ 754 valid=true; 755 if (document.getElementById(`${input.id}-message`)) document.getElementById(`${input.id}-message`).remove(); input.classList.remove('invalid'); 756 } 757 break; 758 case 'file': 759 const id = input.id; 760 valid= input.files[0] ? true : false; 761 //console.log ( "324 check" ,valid ,input.type ,input.id) 762 break; 763 case "text": 764 case "color": 765 case "number": 766 case "date": 767 case "url": 768 case "textarea": 769 value = el.value; 770 console.log(`valid ${el.type}`) 771 if(value.length<5){ 772 state=false; 773 document.getElementById(`${el.id}-message`).innerHTML=ajax_object_efm.text.enterTheValueThisField; 774 775 }else{ 776 el.classList.remove('invalid'); 777 document.getElementById(`${el.id}-message`).innerHTML="" 778 } 779 break; 780 } 781 //console.log ("324 out check" ,valid,input.type ,input.id , input.classList); 782 } else if (input.tagName == "LABEL") { 721 722 try{ 723 const req =input.classList.contains('require'); 724 console.log(input.type); 725 if (input.tagName == "INPUT" ||input.tagName == "TEXTAREA") { 783 726 784 const ll = document.getElementsByName(input.dataset.id); 785 let state = false; 786 787 for (let l of ll) { 788 if (l.checked == true) { 789 input.classList.remove('invalid'); 790 state = true; 791 value = l.value; 792 //console.log('set true', value) 793 } 794 } 795 if (state == false) { 796 value = "" 797 input.className += " invalid"; valid = false; 798 } 799 //console.log(input.dataset.id,value , 240); 800 801 } else if (input.tagName == "SELECT") { 802 //console.log(input.value, "<----select vae",240) 803 if (input.value == "") { 804 input.className += " invalid"; valid = false; 805 } else { 806 value = input.value; 807 //console.log(value, "value select",240) 808 } 809 //console.log(input.dataset.id,`[${value}]` , 240); 810 } 811 if (valid== false){ 812 NotValidCount +=1; 813 //console.log('324 valid comer' ,valid ,NotValidCount); 727 if (input.value == "" && input.classList.contains('require')) { 728 input.className += " invalid"; 729 valid = false; 730 NotValidCount +=1; 731 console.log(`input type[${input.type}] valid[${false}]`) 732 } else { 733 input.classList.remove('invalid'); 734 value = input.value 735 valid=true 736 } 814 737 815 document.getElementById("emsFormBuilder-message-area-view").innerHTML = alarm_emsFormBuilder(ajax_object_efm.text.pleaseFillInRequiredFields); 816 // window.scrollTo({ top: 0, behavior: 'smooth' }); 817 document.getElementById('emsFormBuilder-form-view').scrollIntoView(true); 818 } 819 if (valid == true && NotValidCount==0) { 820 document.getElementsByClassName("emsFormBuilder-step-view")[currentTab_emsFormBuilder].className += " finish"; 821 if (document.getElementById("alarm_emsFormBuilder")) document.getElementById("emsFormBuilder-message-area-view").innerHTML = "" 822 } 823 } 738 switch(input.type){ 739 case 'email': 740 console.log("email0",req ,789987) 741 req===true ? valid= valid_email_emsFormBuilder(input) : valid=true; 742 break; 743 case 'tel': 744 //console.log('707 tel' , req , req===true ,input.classList) 745 req===true ? valid= valid_phone_emsFormBuilder(input) : valid=true; 746 break; 747 case 'password': 748 req===true ? valid= valid_password_emsFormBuilder(input) : valid=true; 749 break; 750 case "range": 751 value = el.value; 752 break; 753 case 'url': 754 const check = input.value.match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g); 755 if (check===null && input.classList.contains('require')==true){ 756 //console.log(check ,999) 757 valid=false; 758 input.className += ' invalid'; 759 document.getElementById(`${input.id}-row`).innerHTML +=`<small class="text-danger" id="${input.id}-message">${ajax_object_efm.text.enterٰValidURL}</small>` 760 }else{ 761 valid=true; 762 if (document.getElementById(`${input.id}-message`)) document.getElementById(`${input.id}-message`).remove(); input.classList.remove('invalid'); 763 } 764 break; 765 case 'file': 766 const id = input.id; 767 valid= input.files[0] ? true : false; 768 //console.log ( "324 check" ,valid ,input.type ,input.id) 769 break; 770 case "text": 771 case "color": 772 case "number": 773 case "date": 774 case "url": 775 case "textarea": 776 value = input.value; 777 console.log(`valid ${el} len [${value.length}] 879`) 778 if(value.length<1){ 779 state=false; 780 document.getElementById(`${el.id}-message`).innerHTML=ajax_object_efm.text.enterTheValueThisField; 781 NotValidCount +=1; 782 }else{ 783 el.classList.remove('invalid'); 784 document.getElementById(`${el.id}-message`).innerHTML="" 785 } 786 break; 787 case "radio": 788 console.log("test"); 789 console.log(input.value) 790 value = "efb@null"; 791 console.log("test"); 792 value=input.value ? input.value :value; 793 console.log("test"); 794 console.log(`value[${value}] el.value[${input.value}]`); 795 valid = true; 796 if(value=="efb@null"){ 797 state=true; 798 valid = false; 799 } 800 801 break; 802 } 803 // if(valid==false) NotValidCount +=1; 804 //console.log ("324 out check" ,valid,input.type ,input.id , input.classList); 805 } else if (input.tagName == "LABEL") { 806 807 const ll = document.getElementsByName(input.dataset.id); 808 let state = false; 809 810 for (let l of ll) { 811 if (l.checked == true) { 812 input.classList.remove('invalid'); 813 state = true; 814 value = l.value; 815 //console.log('set true', value) 816 } 817 } 818 if (state == false) { 819 value = "" 820 input.className += " invalid"; valid = false; 821 } 822 //console.log(input.dataset.id,value , 240); 823 824 } else if (input.tagName == "SELECT") { 825 826 if (input.value == "") { 827 input.className += " invalid"; valid = false; 828 // document.getElementById(`${el.id}-message`).innerHTML=ajax_object_efm.text.enterTheValueThisField; 829 } else { 830 value = input.value; 831 input.classList.remove('invalid'); 832 //console.log(value, "value select",240) 833 } 834 //console.log(input.dataset.id,`[${value}]` , 240); 835 } 836 837 if (valid== false){ 838 NotValidCount +=1; 839 840 841 document.getElementById("emsFormBuilder-message-area-view").innerHTML = alarm_emsFormBuilder(ajax_object_efm.text.pleaseFillInRequiredFields); 842 // window.scrollTo({ top: 0, behavior: 'smooth' }); 843 document.getElementById('emsFormBuilder-form-view').scrollIntoView(true); 844 } 845 if (valid == true && NotValidCount==0) { 846 document.getElementsByClassName("emsFormBuilder-step-view")[currentTab_emsFormBuilder].className += " finish"; 847 if (document.getElementById("alarm_emsFormBuilder")) document.getElementById("emsFormBuilder-message-area-view").innerHTML = "" 848 } 849 }catch(re){ 850 851 } 852 } 853 854 824 855 }catch(re){ 825 856 … … 828 859 829 860 } 830 861 console.log(NotValidCount) 831 862 return NotValidCount>0 ?false:true; 832 863 /* … … 956 987 break; 957 988 case "email": 989 console.log('email') 958 990 state=valid_email_emsFormBuilder(el); 959 991 value = state==true ? el.value :''; 992 console.log(value,'email') 960 993 break; 961 994 case "tel": … … 1004 1037 } 1005 1038 1006 1007 1008 1009 1010 1011 1039 if(value!="" || value.length>1){ 1012 // console.log(el ,ob ,355)1013 1040 const type = el.type || 'multiselect'; 1014 // console.log(type ,355)1015 1041 const o = [{ id_: id_, name: ob.name, type:type, value: value, session: sessionPub_emsFormBuilder }]; 1016 1042 // console.log(o ,968) … … 1028 1054 fun_sendBack_emsFormBuilder(o[0]); 1029 1055 }); 1030 } /* else if (el.type == "select-one" || el.type =="select-multiple"){ 1031 //789 1032 // در اینجا مقدار را می توان گرفت برای مولتی سلکت و غیره 1033 //console.log('selec one',el.id ,el.type) 1034 const dv = document.getElementById(`emsFormBuilder-${el.id}`); 1035 1036 } */ 1037 1038 1039 1056 } 1040 1057 1041 1058 }//end for … … 1047 1064 1048 1065 function fun_sendBack_emsFormBuilder(ob) { // این تابع آبجکت ارسال به سرور مدیریت می کند 1049 //console.log(sendBack_emsFormBuilder_pub.length ,ob, ob.id_)1066 // console.log(sendBack_emsFormBuilder_pub.length ,ob, ob.id_,"email") 1050 1067 if (sendBack_emsFormBuilder_pub.length) { 1051 1068 const indx = sendBack_emsFormBuilder_pub.findIndex(x => x.id_ === ob.id_); … … 1287 1304 el.classList.remove('invalid'); 1288 1305 document.getElementById('emsFormBuilder-text-nextBtn-view').disabled = false 1289 document.getElementById(`${el.id}-message`).innerHTML=''; 1290 /* if (document.getElementById("alarm_emsFormBuilder")) { 1291 el.classList.remove('invalid'); 1292 if (document.getElementById(`${el.id}-message`)) document.getElementById(`${el.id}-message`).remove(); 1293 } */ 1306 document.getElementById(`${el.id}-message`).innerHTML=' '; 1294 1307 } 1295 1308 // if (check>0) alert("Please enter email address"); … … 1489 1502 if(response.data.success===true) 1490 1503 { 1491 r = response.data.file.url;1504 // r = response.data.file.url; 1492 1505 files_emsFormBuilder[indx].url = response.data.file.url; 1493 1506 files_emsFormBuilder[indx].state = 2; … … 1616 1629 //console.log(`sitekye_emsFormBuilder[${sitekye_emsFormBuilder}]`); 1617 1630 let replayM = `<div class="mx-2 mt-2"><div class="form-group mb-1" id="replay_section__emsFormBuilder"> 1618 <label for="replayM_emsFormBuilder"> reply :</label>1631 <label for="replayM_emsFormBuilder">${ajax_object_efm.text.reply}</label> 1619 1632 <textarea class="form-control" id="replayM_emsFormBuilder" rows="3" data-id="${msg_id}"></textarea> 1620 1633 </div> 1621 1634 <div class="col text-right row"> 1622 <button type="submit" class="btn btn-info" id="replayB_emsFormBuilder" OnClick="fun_send_replayMessage_emsFormBuilder(${msg_id})"> reply</button>1635 <button type="submit" class="btn btn-info" id="replayB_emsFormBuilder" OnClick="fun_send_replayMessage_emsFormBuilder(${msg_id})">${ajax_object_efm.text.send} </button> 1623 1636 <!-- recaptcha --> 1624 1637 ${sitekye_emsFormBuilder ? `<div class="row mx-3"><div class="g-recaptcha my-2 mx-2" data-sitekey="${sitekye_emsFormBuilder}"></div><small class="text-danger" id="recaptcha-message"></small></div>` : ``} … … 1661 1674 if (by ==1) {by='Admin'}else if(by==0 ||by.length==0 || by.length==-1 )(by="visitor") 1662 1675 let m =`<Div class="border border-light round p-2"><div class="border-bottom mb-1 pb-1"> 1663 <span class="small"><b> Info:</b></span></br>1664 <span class="small"> By: ${by}</span></br>1665 ${track!=0 ? `<span class="small"> Track No: ${track} </span></br>` :''}1666 <!-- <span> Date: ${date} </span></small> -->1676 <span class="small"><b>${ajax_object_efm.text.info}</b></span></br> 1677 <span class="small">${ajax_object_efm.text.by}: ${by}</span></br> 1678 ${track!=0 ? `<span class="small"> ${ajax_object_efm.text.trackingCode}: ${track} </span></br>` :''} 1679 <!-- <span>${ajax_object_efm.text.date}: ${date} </span></small> --> 1667 1680 </div> 1668 1681 <div class="mx-1"> 1669 <h6 class="my-3"> Response:</h6>`;1682 <h6 class="my-3"> ${ajax_object_efm.text.response} </h6>`; 1670 1683 for (const c of content){ 1671 1684 //JSON.parse(content.replace(/[\\]/g, '')) … … 1761 1774 1762 1775 }) 1763 /* $.post(ajax_object_efm.ajax_url, data, function (res) {1764 if (res.success==true) {1765 //console.log(`response`,res);1766 document.getElementById('replayM_emsFormBuilder').value="";1767 document.getElementById('replay_state__emsFormBuilder').innerHTML=res.data.m;1768 document.getElementById('replayB_emsFormBuilder').classList.remove('disabled');1769 1770 // اضافه شدن به سمت یو آی1771 // const userIp =ajax_object_efm.user_ip;1772 const date = Date();1773 //console.log(message);1774 fun_emsFormBuilder__add_a_response_to_messages(message,res.data.by,0,date);1775 1776 }else{1777 //console.log(res);1778 document.getElementById('replay_state__emsFormBuilder').innerHTML=res.data.m;1779 document.getElementById('replayB_emsFormBuilder').classList.remove('disabled');1780 }1781 }) */1782 1776 }); 1783 1777 } … … 1804 1798 1805 1799 1806 /* //console.log('test',document.getElementsByClassName("multiple-emsFormBuilder"));1807 $(document).ready(function(){1808 var multipleCancelButton = new Choices('.multiple-emsFormBuilder', {1809 maxItemCount:10,1810 searchResultLimit:10,1811 renderChoiceLimit:10,1812 removeItemButton: true1813 });1814 }); */1815 1800 1816 1801 … … 1826 1811 console.log(sendBack_emsFormBuilder_pub); */ 1827 1812 for (const v of valueJson_ws){ 1828 require += v.required== true && v.type!=="file" ? 1 : 0; 1829 1813 // require += v.required== true && v.type!=="file" ? 1 : 0; 1814 // console.log(v.type , v.required ,require); 1815 console.log(v.type) 1830 1816 if(v.type=="file" ){ 1831 if(document.getElementById(v.id_).files[0]==undefined && v.required== true){ 1832 fill -= 1 ; 1833 console.log(`file is ${fill}`); 1834 } 1835 } 1836 } 1817 if( v.required== true){ 1818 require +=1; 1819 /* if (document.getElementById(v.id_).files[0]==undefined ){ 1820 fill += 1; 1821 }else{ 1822 } */ 1823 console.log(`file is ${fill}`); 1824 } 1825 }else{ 1826 //require += v.required== true ? 1 : 0; 1827 // console.log(v.type); 1828 if(v.required==true){ 1829 require += 1; 1830 } 1831 } 1832 } 1833 //210720-8YO43 1834 //console.log(valueJson_ws ,sendBack_emsFormBuilder_pub) 1837 1835 for (const row of sendBack_emsFormBuilder_pub){ 1838 // console.log(row); 1839 // console.log('row'); 1840 count[0] +=1; 1841 if(row.type=="file"){ 1836 //console.log(sendBack_emsFormBuilder_pub); 1837 1838 // console.log('row' ,row.type , row); 1839 //count[0] +=1; 1840 if(row.value=="@file@"){ 1841 console.log(`flie lengh[${document.getElementById(row.id).files.length}]`) 1842 if (document.getElementById(row.id).files.length>=1 )fill += 1; 1842 1843 1843 1844 }else if(row.type!="file"){ 1844 1845 //console.log(valueJson_ws); 1845 1846 let indx = valueJson_ws.findIndex(x => x.id_ == row.id_); 1846 1847 1848 if(valueJson_ws[indx].type=="multiselect" || valueJson_ws[indx].type=="option" || valueJson_ws[indx].type=="Select") { 1849 console.log(valueJson_ws[indx].type ,valueJson_ws[indx].parents, valueJson_ws,indx, "multiselect"); 1850 const exists = valueJson_ws.findIndex(x => x.parents == valueJson_ws[indx].id_); 1851 console.log(valueJson_ws[indx] ,indx , exists, "multiselect"); 1852 fill += valueJson_ws[indx].required== true && exists>-1 ? 1 :0; 1847 console.log(row ,"row"); 1848 console.log(valueJson_ws ,"row"); 1849 if(valueJson_ws[indx].type=="multiselect" || valueJson_ws[indx].type=="option" || valueJson_ws[indx].type=="Select" ||valueJson_ws[indx].type=="checkbox") { 1850 //const id = row.type=="checkbox" ? valueJson_ws[indx].parents : valueJson_ws.findIndex(x => x.parents == valueJson_ws[indx].id_) 1851 //console.log(row.type, valueJson_ws[indx].type ,id); 1852 let id = valueJson_ws.findIndex(x => x.id_ ==valueJson_ws[indx].parents); 1853 if(row.type=="checkbox" || row.type=="radio"){ 1854 id= valueJson_ws[indx].parents ; 1855 // console.log(row ,valueJson_ws[indx],valueJson_ws[indx].parents ,id , "checkbox" ,7777); 1856 id =valueJson_ws.findIndex(x => x.id_ ==valueJson_ws[indx].parents) 1857 }else if(row.type=="select-one"){ 1858 ///id =valueJson_ws.findIndex(x => x.parents == valueJson_ws[indx].id_) 1859 id= valueJson_ws[indx].parents 1860 id =valueJson_ws.findIndex(x => x.id_ ==row.id_) 1861 //console.log(`id[${id}] indx[${indx}]`,valueJson_ws[id] , valueJson_ws[indx] , "Ncheckbox" ,7777); 1862 } 1863 1864 // console.log(id,indx , valueJson_ws[id],fill, "OP"); 1865 fill += id!=-1 && valueJson_ws[id].required==true ? 1 :0; 1866 // console.log(fill,valueJson_ws[id].required==true , "OP"); 1853 1867 }else{ 1854 console.log(valueJson_ws[indx].type ,indx , valueJson_ws[indx], "other"); 1855 fill += valueJson_ws[indx].required== true ? 1 :0; 1856 } 1857 if(row.value.length>0) count[1] +=1; 1868 fill += valueJson_ws[indx].required== true ? 1 :0; 1869 // console.log(valueJson_ws[indx].type ,indx , valueJson_ws[indx],fill, "other"); 1870 1871 } 1872 // if(row.value.length>0) count[1] +=1; 1858 1873 }else{ 1859 if(row.value.length>0) count[1] +=1; 1860 } 1861 1862 } 1863 //console.log(count ,`rquire[${require}] filed[${fill}]`); 1864 require= require>fill ? 1 :0; 1865 if( (count[1]==0 && count[0]!=0) || (count[0]==0 && count[1]==0) ||require==1 ){ 1866 //console.log(sendBack_emsFormBuilder_pub) 1874 // if(row.value.length>0) count[1] +=1; 1875 } 1876 1877 } 1878 count[1]=fill; 1879 console.log(count ,`rquire[${require}] filed[${fill}]`); 1880 // require= require>fill ? 1 :0; 1881 console.log(count,require); 1882 if( ((count[1]==0 && count[0]!=0) || (count[0]==0 && count[1]==0) ) || require>fill ){ 1883 console.log(sendBack_emsFormBuilder_pub) 1867 1884 document.getElementById('emsFormBuilder-text-message-view').innerHTML = `<h1 class='emsFormBuilder'><i class="fas fa-exclamation-triangle faa-flash animated text-danger"></i></h1><h3>${ajax_object_efm.text.error}</h3> <span> <br>${ajax_object_efm.text.error} ${require!=1 ? ajax_object_efm.text.PleaseFillForm : ajax_object_efm.text.pleaseFillInRequiredFields}</span> 1868 1885 <div class="display-btn emsFormBuilder"> <button type="button" id="emsFormBuilder-prevBtn" class="emsformbuilder" onclick="emsFormBuilder_nevButton_view(0)" style="display;"><i class="${ajax_object_efm.rtl==1 ? 'fa fa-angle-double-right' :'fa fa-angle-double-left'}"></i></button></div>`; … … 1925 1942 1926 1943 1927 /* new Code */1928 /* new Code */1929 /* new Code */1930 /* new Code */1931 /* new Code */1932 /* new Code */1933 1934 1944 1935 1945 /* password recovery */ … … 1976 1986 console.log(trackingCode_state_emsFormBuilder); 1977 1987 if ( res.data.success==true ) { 1978 /* console.log(res.data);1979 console.log(form_type_emsFormBuilder); */1980 //console.log(res,localStorage.getItem("sendback"))1981 //form_type_emsFormBuilder یک پیام مرتبت نشان دهد1982 1988 switch(form_type_emsFormBuilder){ 1983 1989 case 'form': -
easy-form-builder/trunk/readme.txt
r2570727 r2570948 1 === Easy Form Builder ===1 === Easy Form Builder === 2 2 Contributors: hassantafreshi, mostafas1990, mrlast, thaikolja, aminkhadivar 3 3 Tags: form builder, form creator, support form, subscribe form,Survey form 4 4 Donate link: https://ko-fi.com/whitestudio 5 Stable tag: 1.34. 45 Stable tag: 1.34.5 6 6 Requires at least: 4.7 7 7 Tested up to: 5.8 … … 21 21 How *Easy Form Builder* makes your life easier: 22 22 - Simple drag and drop functionality 23 23 24 - Create unlimited forms 24 25 - Create multistep (limited steps) form … … 94 95 95 96 == Changelog == 97 98 99 = 1.34.5 = 100 * Fixed issues 101 96 102 = 1.34.4 = 97 103 * Fixed issues
Note: See TracChangeset
for help on using the changeset viewer.