j = 2; var c; var need_enable=true; var a = new Array(); var is_addon_stripe_active; var is_addon_calculator_active; if (ajaxurl.indexOf("://") != -1) { var url_for_ajax = ajaxurl; } else { var url_for_ajax = location.protocol + '//' + location.host + ajaxurl; } function isNumber(n) { return !isNaN(parseFloat(n)) && isFinite(n); } function disable_past_days(value, id) { var dis_past_days = value == true ? true : false; var input_p = document.getElementById(id+'_buttonform_id_temp'); input_p.setAttribute("format", value); } function set_send(id) { if(document.getElementById(id).value=="yes") document.getElementById(id).setAttribute("value", "no") else document.getElementById(id).setAttribute("value", "yes") } function show_datepicker(id){ jQuery("#"+id).datepicker("show"); } function hide_time(id){ if(document.getElementById(id+"form_id_temp").value=="no") { document.getElementById(id+"form_id_temp").value="yes"; } else { document.getElementById(id+"form_id_temp").value="no"; } } function show_week_days(id, week_day){ if(week_day) { if(document.getElementById("el_show_"+week_day).checked==true) document.getElementById(id+"_show_week_days").setAttribute(week_day, "yes"); else document.getElementById(id+"_show_week_days").setAttribute(week_day, "no"); } jQuery("input[name^="+id+"_elementform_id_temp]").datepicker( "option", "beforeShowDay", function(date){ var w_hide_sunday = jQuery("#"+id+"_show_week_days").attr('sunday') == 'yes' ? 'true' : 'day != 0'; var w_hide_monday = jQuery("#"+id+"_show_week_days").attr('monday') == 'yes' ? 'true' : 'day != 1'; var w_hide_tuesday = jQuery("#"+id+"_show_week_days").attr('tuesday') == 'yes' ? 'true' : 'day != 2'; var w_hide_wednesday = jQuery("#"+id+"_show_week_days").attr('wednesday') == 'yes' ? 'true' : 'day != 3'; var w_hide_thursday = jQuery("#"+id+"_show_week_days").attr('thursday') == 'yes' ? 'true' : 'day != 4'; var w_hide_friday = jQuery("#"+id+"_show_week_days").attr('friday') == 'yes' ? 'true' : 'day != 5'; var w_hide_saturday = jQuery("#"+id+"_show_week_days").attr('saturday') == 'yes' ? 'true' : 'day != 6'; var invalid_dates = jQuery("#"+id+"_invalid_dates_id_temp").val(); var invalid_dates_finish = []; var invalid_dates_start = invalid_dates.split(","); var invalid_date_range =[]; for(var i = 0; i < invalid_dates_start.length; i++ ){ invalid_dates_start[i] = invalid_dates_start[i].trim(); if(invalid_dates_start[i].length < 11){ invalid_dates_finish.push(invalid_dates_start[i]); } else{ if(invalid_dates_start[i].indexOf("-") > 4) invalid_date_range.push(invalid_dates_start[i].split("-")); else{ var invalid_date_array = invalid_dates_start[i].split("-"); var start_invalid_day = invalid_date_array[0] + "-" + invalid_date_array[1] + "-" + invalid_date_array[2]; var end_invalid_day = invalid_date_array[3] + "-" + invalid_date_array[4] + "-" + invalid_date_array[5]; invalid_date_range.push([start_invalid_day, end_invalid_day]); } } } jQuery.each(invalid_date_range, function( index, value ) { for(var d = new Date(value[0]); d <= new Date(value[1]); d.setDate(d.getDate() + 1)) { invalid_dates_finish.push(jQuery.datepicker.formatDate("mm/dd/yy", d)); } }); var string_days = jQuery.datepicker.formatDate("mm/dd/yy", date); var day = date.getDay(); return [invalid_dates_finish.indexOf(string_days) == -1 && eval(w_hide_sunday) && eval(w_hide_monday) && eval(w_hide_tuesday) && eval(w_hide_wednesday) && eval(w_hide_thursday) && eval(w_hide_friday) && eval(w_hide_saturday) ]; }); } function set_sel_am_pm(select_) { if(select_.options[0].selected) { select_.options[0].setAttribute("selected", "selected"); select_.options[1].removeAttribute("selected"); } else { select_.options[1].setAttribute("selected", "selected"); select_.options[0].removeAttribute("selected"); } } function change_captcha_digit(digit) { captcha=document.getElementById('_wd_captchaform_id_temp'); if (document.getElementById('captcha_digit').value) { captcha.setAttribute("digit", digit); captcha.setAttribute("src", url_for_ajax + "?action=formmakerwdcaptcha&digit="+digit+"&nonce=" + fm_ajax.ajaxnonce + "&i=form_id_temp"); document.getElementById('_wd_captcha_inputform_id_temp').style.width=(document.getElementById('captcha_digit').value*10+15)+"px"; } else { captcha.setAttribute("digit", "6"); captcha.setAttribute("src", url_for_ajax+"?action=formmakerwdcaptcha&digit=6&nonce=" + fm_ajax.ajaxnonce + "&i=form_id_temp"); document.getElementById('_wd_captcha_inputform_id_temp').style.width=(6*10+15)+"px"; } } function check_isnum_interval(e, id, from, to) { var chCode1 = e.which || e.keyCode; if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) return false; val=""+document.getElementById(id).value+String.fromCharCode(chCode1); if(val.length>2) return false; if(val=='00') return false; if((valto)) return false; return true; } function check_isnum_point(e) { var chCode1 = e.which || e.keyCode; if (chCode1 ==46) return true; if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) return false; return true; } function check_isnum_price(e, value) { var chCode1 = e.which || e.keyCode; if(value == '' || value.indexOf(".") > -1){ if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) return false; } if (chCode1 > 31 && chCode1!=46 && (chCode1 < 48 || chCode1 > 57)) return false; return true; } function check_isspacebar(e) { var chCode1 = e.which || e.keyCode; if (chCode1 == 32 ) return false; return true; } function change_w_label(id, w) { if(document.getElementById(id)) document.getElementById(id).innerHTML=w; } function change_w(id, w) { document.getElementById(id).setAttribute("width", w) } function change_h(id, h) { document.getElementById(id).setAttribute("height", h); } function change_key(value, attribute) { document.getElementById('wd_recaptchaform_id_temp').setAttribute(attribute, value); } function captcha_refresh(id) { srcArr=document.getElementById(id+"form_id_temp").src.split("&r="); document.getElementById(id+"form_id_temp").src=srcArr[0]+'&r='+Math.floor(Math.random()*100); document.getElementById(id+"_inputform_id_temp").value=''; } function up_row(id) { if (typeof event != "undefined") { event.stopPropagation(); } wdform_field=document.getElementById("wdform_field"+id); wdform_row=wdform_field.parentNode; wdform_column=wdform_row.parentNode; wdform_section=wdform_column.parentNode; wdform_page=wdform_section.parentNode; k=0; while(wdform_column.childNodes[k]) { if(wdform_column.childNodes[k].getAttribute("wdid")) if(id==wdform_column.childNodes[k].getAttribute("wdid")) break; k++; } if(k!=0) { up=wdform_column.childNodes[k-1]; down=wdform_column.childNodes[k]; wdform_column.removeChild(down); wdform_column.insertBefore(down, up); return; } ///////////en depqum yerb section breaka if(wdform_section.previousSibling) { if(wdform_section.previousSibling.getAttribute('type')) { wdform_section.previousSibling.previousSibling.firstChild.appendChild(wdform_row); return; } } ///////////pagei mej page_up(id); } function down_row(id) { if (typeof event != "undefined") { event.stopPropagation(); } wdform_field=document.getElementById("wdform_field"+id); wdform_row=wdform_field.parentNode; wdform_column=wdform_row.parentNode; wdform_section=wdform_column.parentNode; wdform_page=wdform_section.parentNode; l=wdform_column.childNodes.length; /* form=wdform_column */ k=0; while(wdform_column.childNodes[k]) { if(wdform_column.childNodes[k].getAttribute("wdid")) if(id==wdform_column.childNodes[k].getAttribute("wdid")) break; k++; } if(k!=l-1) { ///////////ira mej up=wdform_column.childNodes[k]; down=wdform_column.childNodes[k+2]; wdform_column.removeChild(up); if(!down) down=null; wdform_column.insertBefore(up, down); return; } ///////////en depqum yerb section breaka if(wdform_section.nextSibling.getAttribute('type')) { wdform_section.nextSibling.nextSibling.firstChild.appendChild(wdform_row); return; } ///////////pagei mej page_down(id); } function right_row(id) { if (typeof event != "undefined") { event.stopPropagation(); } wdform_field=document.getElementById("wdform_field"+id); wdform_row=wdform_field.parentNode; wdform_column=wdform_row.parentNode; wdform_section=wdform_column.parentNode; if(wdform_column.nextSibling!=null) { wdform_column_next=wdform_column.nextSibling; wdform_column_next.appendChild(wdform_row); } else { var wdform_column_new = document.createElement('div'); wdform_column_new.setAttribute("class", "wdform_column"); wdform_section.appendChild(wdform_column_new); wdform_column_new.appendChild(wdform_row); } // if(wdform_column.firstChild==null) // wdform_section.removeChild(wdform_column); sortable_columns(); } function left_row(id) { if (typeof event != "undefined") { event.stopPropagation(); } wdform_field=document.getElementById("wdform_field"+id); wdform_row=wdform_field.parentNode; wdform_column=wdform_row.parentNode; wdform_section=wdform_column.parentNode; if(wdform_column.previousSibling!=null) { wdform_column_next=wdform_column.previousSibling; wdform_column_next.appendChild(wdform_row); } // if(wdform_column.firstChild==null) // wdform_section.removeChild(wdform_column); sortable_columns(); } function page_up(id) { if (typeof event != "undefined") { event.stopPropagation(); } wdform_field = document.getElementById("wdform_field" + id); wdform_row = wdform_field.parentNode; wdform_column = wdform_row.parentNode; wdform_section = wdform_column.parentNode; wdform_page = wdform_section.parentNode; wdform_page_and_images = wdform_page.parentNode; while (wdform_page_and_images) { wdform_page_and_images = wdform_page_and_images.previousSibling; if (!wdform_page_and_images) { alert('Unable to move'); return; } if (jQuery(wdform_page_and_images.firstChild).is(":visible")) { break; } } n = wdform_page_and_images.getElementsByClassName("wdform_page")[0].childNodes.length; wdform_page_and_images.getElementsByClassName("wdform_page")[0].childNodes[n - 2].firstChild.appendChild(wdform_row); refresh_pages(id); } function page_down(id) { if (typeof event != "undefined") { event.stopPropagation(); } wdform_field = document.getElementById("wdform_field" + id); wdform_row = wdform_field.parentNode; wdform_column = wdform_row.parentNode; wdform_section = wdform_column.parentNode; wdform_page = wdform_section.parentNode; wdform_page_and_images = wdform_page.parentNode; while (wdform_page_and_images) { wdform_page_and_images = wdform_page_and_images.nextSibling; if (!wdform_page_and_images || wdform_page_and_images.id == 'add_field_cont') { alert('Unable to move'); return; } if (jQuery(wdform_page_and_images.firstChild).is(":visible")) { break; } } wdform_page_and_images.getElementsByClassName("wdform_page")[0].firstChild.firstChild.insertBefore(wdform_row, wdform_page_and_images.firstChild.firstChild.firstChild.firstChild); refresh_pages(id); } function remove_whitespace(node) { var ttt; for (ttt=0; ttt < node.childNodes.length; ttt++) { if( node.childNodes[ttt] && node.childNodes[ttt].nodeType == '3' && !/\S/.test( node.childNodes[ttt].nodeValue )) { node.removeChild(node.childNodes[ttt]); ttt--; } else { if(node.childNodes[ttt].childNodes.length) remove_whitespace(node.childNodes[ttt]); } } return } function Disable() { //select_=document.getElementById('sel_el_pos'); //select_.setAttribute("disabled", "disabled"); //select_.innerHTML=""; } function all_labels() { labels=new Array(); for(k=1;k<=form_view_max;k++) if(document.getElementById('form_id_tempform_view'+k)) { wdform_page=document.getElementById('form_id_tempform_view'+k); remove_whitespace(wdform_page); n=wdform_page.childNodes.length-2; for(z=0;z<=n;z++) { if(!wdform_page.childNodes[z].getAttribute("wdid")) { wdform_section=wdform_page.childNodes[z]; for (x=0; x < wdform_section.childNodes.length; x++) { wdform_column=wdform_section.childNodes[x]; if(wdform_column.firstChild) for (y=0; y < wdform_column.childNodes.length; y++) { wdform_row=wdform_column.childNodes[y]; if(wdform_row.nodeType==3) continue; wdid=wdform_row.getAttribute("wdid"); if(!wdid) continue; labels.push( document.getElementById( wdid+'_element_labelform_id_temp').innerHTML); } } } } } return labels; } function set_checked(id,j) { checking=document.getElementById(id+"_elementform_id_temp"+j); if(checking.checked) checking.setAttribute("checked", "checked"); if(!checking.checked) { checking.removeAttribute("checked"); if(checking.getAttribute('other')) if(checking.getAttribute('other')==1) { if(document.getElementById(id+"_other_inputform_id_temp")) { document.getElementById(id+"_other_inputform_id_temp").parentNode.removeChild(document.getElementById(id+"_other_brform_id_temp")); document.getElementById(id+"_other_inputform_id_temp").parentNode.removeChild(document.getElementById(id+"_other_inputform_id_temp")); } return false; } } return true; } function set_default(id, j) { for(k=0; k<100; k++) if(document.getElementById(id+"_elementform_id_temp"+k)) if(!document.getElementById(id+"_elementform_id_temp"+k).checked) document.getElementById(id+"_elementform_id_temp"+k).removeAttribute("checked"); else document.getElementById(id+"_elementform_id_temp"+j).setAttribute("checked", "checked"); if(document.getElementById(id+"_other_inputform_id_temp")) { document.getElementById(id+"_other_inputform_id_temp").parentNode.removeChild(document.getElementById(id+"_other_brform_id_temp")); document.getElementById(id+"_other_inputform_id_temp").parentNode.removeChild(document.getElementById(id+"_other_inputform_id_temp")); } } function set_select(select_) { for (p = select_.length - 1; p>=0; p--) if (select_.options[p].selected) select_.options[p].setAttribute("selected", "selected"); else select_.options[p].removeAttribute("selected"); } function add_0(id) { input=document.getElementById(id); if(input.value.length==1) { input.value='0'+input.value; input.setAttribute("value", input.value); } } function label_top_stripe(num) { document.getElementById(num+'_label_sectionform_id_temp').style.display="block"; document.getElementById(num+'_element_sectionform_id_temp').style.display="block"; } function label_left_stripe(num) { document.getElementById(num+'_label_sectionform_id_temp').style.display="table-cell"; document.getElementById(num+'_element_sectionform_id_temp').style.display="table-cell"; } function change_value_range(id, min_max, element_value) { jQuery("#"+id).datepicker('option', min_max, element_value); } function change_func(id, label) { document.getElementById(id).setAttribute("onclick", label); } function change_in_value(id, label) { label = label.replace(/(<([^>]+)>)/ig, ""); label = label.replace(/"/g, """); document.getElementById(id).setAttribute("value", label); } function change_size(size, num) { document.getElementById(num+'_elementform_id_temp').style.width=size+'px'; if (document.getElementById(num+'_element_input')) { document.getElementById(num+'_element_input').style.width=size+'px'; } switch(size) { case '111': { document.getElementById(num+'_elementform_id_temp').setAttribute("rows", "2"); break; } case '222': { document.getElementById(num+'_elementform_id_temp').setAttribute("rows", "4");break; } case '444': { document.getElementById(num+'_elementform_id_temp').setAttribute("rows", "8");break; } } } function getIFrameDocument(aID){ var rv = null; // if contentDocument exists, W3C compliant (Mozilla) if (document.getElementById(aID) && document.getElementById(aID).contentDocument){ rv = document.getElementById(aID).contentDocument; } else if (document.getElementById(aID)) { // IE rv = document.frames[aID].document; } return rv; } function format_extended(num,w_title_value,w_middle_value,w_title_title,w_middle_title) { w_size=document.getElementById(num+'_element_firstform_id_temp').style.width; tr_name1 = document.getElementById(num+'_tr_name1'); tr_name2 = document.getElementById(num+'_tr_name2'); var td_name_input1 = document.createElement('div'); td_name_input1.setAttribute("id", num+"_td_name_input_title"); td_name_input1.style.display='table-cell'; var td_name_input4 = document.createElement('div'); td_name_input4.setAttribute("id", num+"_td_name_input_middle"); td_name_input4.style.display='table-cell'; var td_name_label1 = document.createElement('div'); td_name_label1.setAttribute("id", num+"_td_name_label_title"); td_name_label1.setAttribute("align", "left"); td_name_label1.style.display='table-cell'; var td_name_label4 = document.createElement('div'); td_name_label4.setAttribute("id", num+"_td_name_label_middle"); td_name_label4.setAttribute("align", "left"); td_name_label4.style.display='table-cell'; var title = document.createElement('input'); title.setAttribute("type", 'text'); title.style.cssText = "margin: 0px 10px 0px 0px; padding: 0px; width:40px"; title.setAttribute("id", num+"_element_titleform_id_temp"); title.setAttribute("name", num+"_element_titleform_id_temp"); if(w_title_value==w_title_title) { title.setAttribute("value", w_title_title); } else { title.setAttribute("value", w_title_value); } title.setAttribute("title", w_title_title); var title_label = document.createElement('label'); title_label.setAttribute("class", "mini_label"); title_label.setAttribute("id", num+"_mini_label_title"); title_label.innerHTML= w_mini_labels[0]; var middle = document.createElement('input'); middle.setAttribute("type", 'text'); middle.style.cssText = "padding: 0px; width:"+w_size; middle.setAttribute("id", num+"_element_middleform_id_temp"); middle.setAttribute("name", num+"_element_middleform_id_temp"); if(w_middle_value==w_middle_title) { middle.setAttribute("value", w_middle_title); } else { middle.setAttribute("value", w_middle_value); } middle.setAttribute("title", w_middle_title); var middle_label = document.createElement('label'); middle_label.setAttribute("class", "mini_label"); middle_label.setAttribute("id", num+"_mini_label_middle"); middle_label.innerHTML=w_mini_labels[3]; first_input = document.getElementById(num+'_td_name_input_first'); last_input = document.getElementById(num+'_td_name_input_last'); first_label = document.getElementById(num+'_td_name_label_first'); last_label = document.getElementById(num+'_td_name_label_last'); td_name_input1.appendChild(title); td_name_input4.appendChild(middle); tr_name1.insertBefore(td_name_input1, first_input); tr_name1.insertBefore(td_name_input4, null); td_name_label1.appendChild(title_label); td_name_label4.appendChild(middle_label); tr_name2.insertBefore(td_name_label1, first_label); tr_name2.insertBefore(td_name_label4, null); var gic1 = document.createTextNode("-"); var gic2 = document.createTextNode("-"); var el_first_value_title = document.createElement('input'); el_first_value_title.setAttribute("id", "el_first_value_title"); el_first_value_title.setAttribute("type", "text"); el_first_value_title.setAttribute("value", w_title_title); el_first_value_title.style.cssText = "width:50px; margin-left:4px; margin-right:4px"; el_first_value_title.setAttribute("onKeyUp", "change_input_value(this.value,'"+num+"_element_titleform_id_temp')"); var el_first_value_middle = document.createElement('input'); el_first_value_middle.setAttribute("id", "el_first_value_middle"); el_first_value_middle.setAttribute("type", "text"); el_first_value_middle.setAttribute("value", w_middle_title); el_first_value_middle.style.cssText = "width:100px; margin-left:4px"; el_first_value_middle.setAttribute("onKeyUp", "change_input_value(this.value,'"+num+"_element_middleform_id_temp')"); el_first_value_first = document.getElementById('el_first_value_first'); parent=el_first_value_first.parentNode; parent.insertBefore(gic1, el_first_value_first); parent.insertBefore(el_first_value_title, gic1); parent.appendChild(gic2); parent.appendChild(el_first_value_middle); refresh_attr(num, 'type_name'); refresh_id_name(num, 'type_name'); jQuery(document).ready(function() { jQuery("label#"+num+"_mini_label_title").on("click", function() { if (jQuery(this).children('input').length == 0) { var title = ""; jQuery(this).html(title); jQuery("input.title").focus(); jQuery("input.title").blur(function() { var value = jQuery(this).val(); jQuery("#"+num+"_mini_label_title").text(value); }); } }); jQuery("label#"+num+"_mini_label_middle").on("click", function() { if (jQuery(this).children('input').length == 0) { var middle = ""; jQuery(this).html(middle); jQuery("input.middle").focus(); jQuery("input.middle").blur(function() { var value = jQuery(this).val(); jQuery("#"+num+"_mini_label_middle").text(value); }); } }); }); } function format_normal(num) { tr_name1 = document.getElementById(num+'_tr_name1'); tr_name2 = document.getElementById(num+'_tr_name2'); td_name_input1 = document.getElementById(num+'_td_name_input_title'); td_name_input4 = document.getElementById(num+'_td_name_input_middle'); td_name_label1 = document.getElementById(num+'_td_name_label_title'); td_name_label4 =document.getElementById(num+'_td_name_label_middle'); tr_name1.removeChild(td_name_input1); tr_name1.removeChild(td_name_input4); tr_name2.removeChild(td_name_label1); tr_name2.removeChild(td_name_label4); el_first_value_first = document.getElementById('el_first_value_first'); parent=el_first_value_first.parentNode; parent.removeChild( document.getElementById('el_first_value_title').nextSibling); parent.removeChild( document.getElementById('el_first_value_title')); parent.removeChild( document.getElementById('el_first_value_middle').previousSibling); parent.removeChild( document.getElementById('el_first_value_middle')); refresh_attr(num, 'type_name'); refresh_id_name(num, 'type_name'); } function type_number(i, w_field_label, w_field_label_size, w_field_label_pos, w_size, w_first_val, w_title, w_required, w_unique, w_class, w_attr_name, w_attr_value) { document.getElementById("element_type").value="type_number"; delete_last_child(); var edit_div = document.createElement('div'); edit_div.setAttribute("id", "edit_div"); var edit_main_table = document.createElement('table'); edit_main_table.setAttribute("id", "edit_main_table"); edit_main_table.setAttribute("cellpadding", "3"); edit_main_table.setAttribute("cellspacing", "0"); var edit_main_tr1 = document.createElement('tr'); var edit_main_tr2 = document.createElement('tr'); var edit_main_tr3 = document.createElement('tr'); var edit_main_tr4 = document.createElement('tr'); var edit_main_tr5 = document.createElement('tr'); var edit_main_tr6 = document.createElement('tr'); var edit_main_tr7 = document.createElement('tr'); var edit_main_tr8 = document.createElement('tr'); var edit_main_tr9 = document.createElement('tr'); var edit_main_td1 = document.createElement('td'); var edit_main_td1_1 = document.createElement('td'); var edit_main_td2 = document.createElement('td'); var edit_main_td2_1 = document.createElement('td'); var edit_main_td3 = document.createElement('td'); var edit_main_td3_1 = document.createElement('td'); var edit_main_td4 = document.createElement('td'); var edit_main_td4_1 = document.createElement('td'); var edit_main_td5 = document.createElement('td'); var edit_main_td5_1 = document.createElement('td'); var edit_main_td6 = document.createElement('td'); var edit_main_td6_1 = document.createElement('td'); var edit_main_td7 = document.createElement('td'); var edit_main_td7_1 = document.createElement('td'); var edit_main_td8 = document.createElement('td'); var edit_main_td8_1 = document.createElement('td'); var edit_main_td9 = document.createElement('td'); var edit_main_td9_1 = document.createElement('td'); var el_label_label = document.createElement('label'); el_label_label.setAttribute("class", "fm-field-label"); el_label_label.setAttribute("for", "edit_for_label"); el_label_label.innerHTML = "Field label"; var el_label_textarea = document.createElement('textarea'); el_label_textarea.setAttribute("id", "edit_for_label"); el_label_textarea.setAttribute("rows", "4"); el_label_textarea.setAttribute("onKeyUp", "change_label('"+i+"_element_labelform_id_temp', this.value)"); el_label_textarea.innerHTML = w_field_label; var el_label_size_label = document.createElement('label'); el_label_size_label.setAttribute("class", "fm-field-label"); el_label_size_label.setAttribute("for", "edit_for_label_size"); el_label_size_label.innerHTML = "Field label size(px) "; var el_label_size = document.createElement('input'); el_label_size.setAttribute("id", "edit_for_label_size"); el_label_size.setAttribute("type", "text"); el_label_size.setAttribute("value", w_field_label_size); el_label_size.setAttribute("onKeyPress", "return check_isnum(event)"); el_label_size.setAttribute("onKeyUp", "change_w_style('"+i+"_label_sectionform_id_temp', this.value)"); var el_label_position_label = document.createElement('label'); el_label_position_label.setAttribute("class", "fm-field-label"); el_label_position_label.innerHTML = "Field label position"; var el_label_position1 = document.createElement('input'); el_label_position1.setAttribute("id", "edit_for_label_position_top"); el_label_position1.setAttribute("type", "radio"); el_label_position1.setAttribute("name", "edit_for_label_position"); el_label_position1.setAttribute("onchange", "label_left("+i+")"); var el_label_left = document.createElement('label'); el_label_left.setAttribute("for", "edit_for_label_position_top"); el_label_left.innerHTML = "Left"; var el_label_position2 = document.createElement('input'); el_label_position2.setAttribute("id", "edit_for_label_position_left"); el_label_position2.setAttribute("type", "radio"); el_label_position2.setAttribute("name", "edit_for_label_position"); el_label_position2.setAttribute("onchange", "label_top("+i+")"); var el_label_top = document.createElement('label'); el_label_top.setAttribute("for", "edit_for_label_position_left"); el_label_top.innerHTML = "Top"; if(w_field_label_pos=="top") el_label_position2.setAttribute("checked", "checked"); else el_label_position1.setAttribute("checked", "checked"); var el_size_label = document.createElement('label'); el_size_label.setAttribute("class", "fm-field-label"); el_size_label.setAttribute("for", "edit_for_input_size"); el_size_label.innerHTML = "Field size(px) "; var el_size = document.createElement('input'); el_size.setAttribute("id", "edit_for_input_size"); el_size.setAttribute("type", "text"); el_size.setAttribute("value", w_size); el_size.setAttribute("onKeyPress", "return check_isnum(event)"); el_size.setAttribute("onKeyUp", "change_w_style('"+i+"_elementform_id_temp', this.value)"); var el_first_value_label = document.createElement('label'); el_first_value_label.setAttribute("class", "fm-field-label"); el_first_value_label.setAttribute("for", "el_first_value_input"); el_first_value_label.innerHTML = "Placeholder "; var el_first_value_input = document.createElement('input'); el_first_value_input.setAttribute("id", "el_first_value_input"); el_first_value_input.setAttribute("type", "text"); el_first_value_input.setAttribute("value", w_title); el_first_value_input.setAttribute("onKeyUp", "change_input_value(this.value,'"+i+"_elementform_id_temp');"); var el_required_label = document.createElement('label'); el_required_label.setAttribute("class", "fm-field-label"); el_required_label.setAttribute("for", "el_required"); el_required_label.innerHTML = "Required"; var el_required = document.createElement('input'); el_required.setAttribute("id", "el_required"); el_required.setAttribute("type", "checkbox"); el_required.setAttribute("onclick", "set_required('"+i+"_required')"); if(w_required=="yes") el_required.setAttribute("checked", "checked"); var el_unique_label = document.createElement('label'); el_unique_label.setAttribute("class", "fm-field-label"); el_unique_label.setAttribute("for", "el_unique"); el_unique_label.innerHTML = "Allow only unique values"; var el_unique = document.createElement('input'); el_unique.setAttribute("id", "el_unique"); el_unique.setAttribute("type", "checkbox"); el_unique.setAttribute("onclick", "set_unique('"+i+"_uniqueform_id_temp')"); if(w_unique=="yes") el_unique.setAttribute("checked", "checked"); var el_style_label = document.createElement('label'); el_style_label.setAttribute("class", "fm-field-label"); el_style_label.setAttribute("for", "el_style_textarea"); el_style_label.innerHTML = "Class name"; var el_style_textarea = document.createElement('input'); el_style_textarea.setAttribute("id", "el_style_textarea"); el_style_textarea.setAttribute("type", "text"); el_style_textarea.setAttribute("value", w_class); el_style_textarea.setAttribute("onChange", "change_class(this.value,'"+i+"')"); var el_attr_label = document.createElement('label'); el_attr_label.setAttribute("class", "fm-field-label"); el_attr_label.innerHTML = "Additional Attributes"; var el_attr_add = document.createElement('img'); el_attr_add.setAttribute("src", plugin_url + '/images/add.png?ver=1.8.0'); el_attr_add.style.cssText = 'cursor:pointer; margin-left:68px'; el_attr_add.setAttribute("title", 'add'); el_attr_add.setAttribute("onClick", "add_attr("+i+", 'type_text')"); var el_attr_table = document.createElement('table'); el_attr_table.setAttribute("id", 'attributes'); el_attr_table.setAttribute("border", '0'); el_attr_table.style.cssText = 'margin-left:0px'; var el_attr_tr_label = document.createElement('tr'); el_attr_tr_label.setAttribute("idi", '0'); var el_attr_td_name_label = document.createElement('th'); el_attr_td_name_label.style.cssText = 'width:100px'; var el_attr_td_value_label = document.createElement('th'); el_attr_td_value_label.style.cssText = 'width:100px'; var el_attr_td_X_label = document.createElement('th'); el_attr_td_X_label.style.cssText = 'width:10px'; var el_attr_name_label = document.createElement('label'); el_attr_name_label.style.cssText ="color:#000; font-weight:bold; font-size: 11px"; el_attr_name_label.innerHTML = "Name"; var el_attr_value_label = document.createElement('label'); el_attr_value_label.style.cssText ="color:#000; font-weight:bold; font-size: 11px"; el_attr_value_label.innerHTML = "Value"; el_attr_table.appendChild(el_attr_tr_label); el_attr_tr_label.appendChild(el_attr_td_name_label); el_attr_tr_label.appendChild(el_attr_td_value_label); el_attr_tr_label.appendChild(el_attr_td_X_label); el_attr_td_name_label.appendChild(el_attr_name_label); el_attr_td_value_label.appendChild(el_attr_value_label); n=w_attr_name.length; for(j=1; j<=n; j++) { var el_attr_tr = document.createElement('tr'); el_attr_tr.setAttribute("id", "attr_row_"+j); el_attr_tr.setAttribute("idi", j); var el_attr_td_name = document.createElement('td'); el_attr_td_name.style.cssText = 'width:100px'; var el_attr_td_value = document.createElement('td'); el_attr_td_value.style.cssText = 'width:100px'; var el_attr_td_X = document.createElement('td'); var el_attr_name = document.createElement('input'); el_attr_name.setAttribute("type", "text"); el_attr_name.setAttribute("class", "fm-field-choice"); el_attr_name.setAttribute("value", w_attr_name[j-1]); el_attr_name.setAttribute("id", "attr_name"+j); el_attr_name.setAttribute("onChange", "change_attribute_name("+i+", this, 'type_text')"); var el_attr_value = document.createElement('input'); el_attr_value.setAttribute("type", "text"); el_attr_value.setAttribute("class", "fm-field-choice"); el_attr_value.setAttribute("value", w_attr_value[j-1]); el_attr_value.setAttribute("id", "attr_value"+j); el_attr_value.setAttribute("onChange", "change_attribute_value("+i+", "+j+", 'type_text')"); var el_attr_remove = document.createElement('img'); el_attr_remove.setAttribute("id", "el_choices"+j+"_remove"); el_attr_remove.setAttribute("src", plugin_url + '/images/delete.png?ver=1.8.0'); el_attr_remove.style.cssText = 'cursor:pointer; vertical-align:middle; margin:2px'; el_attr_remove.setAttribute("onClick", "remove_attr("+j+", "+i+", 'type_text')"); el_attr_table.appendChild(el_attr_tr); el_attr_tr.appendChild(el_attr_td_name); el_attr_tr.appendChild(el_attr_td_value); el_attr_tr.appendChild(el_attr_td_X); el_attr_td_name.appendChild(el_attr_name); el_attr_td_value.appendChild(el_attr_value); el_attr_td_X.appendChild(el_attr_remove); } var t = document.getElementById('edit_table'); var br = document.createElement('br'); var br6 = document.createElement('br'); edit_main_td1.appendChild(el_label_label); edit_main_td1_1.appendChild(el_label_textarea); edit_main_td9.appendChild(el_label_size_label); edit_main_td9_1.appendChild(el_label_size); edit_main_td2.appendChild(el_label_position_label); edit_main_td2_1.appendChild(el_label_position1); edit_main_td2_1.appendChild(el_label_left); edit_main_td2_1.appendChild(br); edit_main_td2_1.appendChild(el_label_position2); edit_main_td2_1.appendChild(el_label_top); edit_main_td3.appendChild(el_size_label); edit_main_td3_1.appendChild(el_size); edit_main_td4.appendChild(el_first_value_label); edit_main_td4_1.appendChild(el_first_value_input); edit_main_td5.appendChild(el_style_label); edit_main_td5_1.appendChild(el_style_textarea); edit_main_td6.appendChild(el_required_label); edit_main_td6_1.appendChild(el_required); edit_main_td8.appendChild(el_unique_label); edit_main_td8_1.appendChild(el_unique); edit_main_td7.appendChild(el_attr_label); edit_main_td7.appendChild(el_attr_add); edit_main_td7.appendChild(br6); edit_main_td7.appendChild(el_attr_table); edit_main_td7.setAttribute("colspan", "2"); edit_main_tr1.appendChild(edit_main_td1); edit_main_tr1.appendChild(edit_main_td1_1); edit_main_tr9.appendChild(edit_main_td9); edit_main_tr9.appendChild(edit_main_td9_1); edit_main_tr2.appendChild(edit_main_td2); edit_main_tr2.appendChild(edit_main_td2_1); edit_main_tr3.appendChild(edit_main_td3); edit_main_tr3.appendChild(edit_main_td3_1); edit_main_tr4.appendChild(edit_main_td4); edit_main_tr4.appendChild(edit_main_td4_1); edit_main_tr5.appendChild(edit_main_td5); edit_main_tr5.appendChild(edit_main_td5_1); edit_main_tr6.appendChild(edit_main_td6); edit_main_tr6.appendChild(edit_main_td6_1); edit_main_tr8.appendChild(edit_main_td8); edit_main_tr8.appendChild(edit_main_td8_1); edit_main_tr7.appendChild(edit_main_td7); edit_main_table.appendChild(edit_main_tr1); edit_main_table.appendChild(edit_main_tr9); edit_main_table.appendChild(edit_main_tr2); edit_main_table.appendChild(edit_main_tr3); edit_main_table.appendChild(edit_main_tr4); edit_main_table.appendChild(edit_main_tr5); edit_main_table.appendChild(edit_main_tr6); edit_main_table.appendChild(edit_main_tr8); edit_main_table.appendChild(edit_main_tr7); edit_div.appendChild(edit_main_table); t.appendChild(edit_div); add_id_and_name(i, 'type_text'); //show table element='input'; type='text'; var adding_type = document.createElement("input"); adding_type.setAttribute("type", "hidden"); adding_type.setAttribute("value", "type_number"); adding_type.setAttribute("name", i+"_typeform_id_temp"); adding_type.setAttribute("id", i+"_typeform_id_temp"); var adding_required= document.createElement("input"); adding_required.setAttribute("type", "hidden"); adding_required.setAttribute("value", w_required); adding_required.setAttribute("name", i+"_requiredform_id_temp"); adding_required.setAttribute("id", i+"_requiredform_id_temp"); var adding_unique= document.createElement("input"); adding_unique.setAttribute("type", "hidden"); adding_unique.setAttribute("value", w_unique); adding_unique.setAttribute("name", i+"_uniqueform_id_temp"); adding_unique.setAttribute("id", i+"_uniqueform_id_temp"); var adding = document.createElement(element); adding.setAttribute("type", type); if(w_title==w_first_val) { adding.style.cssText = "width:"+w_size+"px;"; } else { adding.style.cssText = "width:"+w_size+"px;"; } adding.setAttribute("id", i+"_elementform_id_temp"); adding.setAttribute("name", i+"_elementform_id_temp"); adding.setAttribute("value", w_first_val); adding.setAttribute("title", w_title); adding.setAttribute("placeholder", w_title); adding.setAttribute("onKeyPress", "return check_isnum(event)"); var div = document.createElement('div'); div.setAttribute("id", "main_div"); var div_field = document.createElement('div'); div_field.setAttribute("id", i+"_elemet_tableform_id_temp"); var div_label = document.createElement('div'); div_label.setAttribute("align", 'left'); div_label.style.display="table-cell"; div_label.style.width=w_field_label_size+"px"; div_label.setAttribute("id", i+"_label_sectionform_id_temp"); var div_element = document.createElement('div'); div_element.setAttribute("align", 'left'); div_element.style.display="table-cell"; div_element.setAttribute("id", i+"_element_sectionform_id_temp"); var label = document.createElement('span'); label.setAttribute("id", i+"_element_labelform_id_temp"); label.innerHTML = w_field_label; label.setAttribute("class", "label"); label.style.verticalAlign="top"; var required = document.createElement('span'); required.setAttribute("id", i+"_required_elementform_id_temp"); required.innerHTML = ""; required.setAttribute("class", "required"); required.style.verticalAlign="top"; if(w_required=="yes") required.innerHTML = " *"; var main_td = document.getElementById('show_table'); div_label.appendChild(label); div_label.appendChild(required); div_element.appendChild(adding_type); div_element.appendChild(adding_required); div_element.appendChild(adding_unique); div_element.appendChild(adding); div_field.appendChild(div_label); div_field.appendChild(div_element); div.appendChild(div_field); main_td.appendChild(div); if(w_field_label_pos=="top") label_top(i); change_class(w_class, i); refresh_attr(i, 'type_text'); } function type_wdeditor(i, w_field_label, w_field_label_size, w_field_label_pos, w_size_w, w_size_h, w_title, w_required, w_class, w_attr_name, w_attr_value){ document.getElementById("element_type").value="type_wdeditor"; delete_last_child(); // edit table var edit_div = document.createElement('div'); edit_div.setAttribute("id", "edit_div"); var edit_main_table = document.createElement('table'); edit_main_table.setAttribute("id", "edit_main_table"); edit_main_table.setAttribute("cellpadding", "3"); edit_main_table.setAttribute("cellspacing", "0"); var edit_main_tr1 = document.createElement('tr'); var edit_main_tr2 = document.createElement('tr'); var edit_main_tr3 = document.createElement('tr'); var edit_main_tr4 = document.createElement('tr'); var edit_main_tr5 = document.createElement('tr'); var edit_main_tr6 = document.createElement('tr'); var edit_main_tr7 = document.createElement('tr'); var edit_main_tr8 = document.createElement('tr'); var edit_main_td1 = document.createElement('td'); var edit_main_td1_1 = document.createElement('td'); var edit_main_td2 = document.createElement('td'); var edit_main_td2_1 = document.createElement('td');var edit_main_td3 = document.createElement('td'); var edit_main_td3_1 = document.createElement('td'); edit_main_td3_1.style.cssText = "padding-top:10px"; var edit_main_td4 = document.createElement('td'); var edit_main_td4_1 = document.createElement('td'); edit_main_td4_1.style.cssText = "padding-top:10px"; var edit_main_td5 = document.createElement('td'); var edit_main_td5_1 = document.createElement('td'); edit_main_td5_1.style.cssText = "padding-top:10px"; var edit_main_td6 = document.createElement('td'); var edit_main_td6_1 = document.createElement('td'); edit_main_td6_1.style.cssText = "padding-top:10px"; var edit_main_td7 = document.createElement('td'); var edit_main_td7_1 = document.createElement('td'); var edit_main_td8 = document.createElement('td'); var edit_main_td8_1 = document.createElement('td'); var el_label_label = document.createElement('label'); el_label_label.setAttribute("class", "fm-field-label"); el_label_label.setAttribute("for", "edit_for_label"); el_label_label.innerHTML = "Field label"; var el_label_textarea = document.createElement('textarea'); el_label_textarea.setAttribute("id", "edit_for_label"); el_label_textarea.setAttribute("rows", "4"); el_label_textarea.setAttribute("onKeyUp", "change_label('"+i+"_element_labelform_id_temp', this.value)"); el_label_textarea.innerHTML = w_field_label; var el_label_size_label = document.createElement('label'); el_label_size_label.setAttribute("class", "fm-field-label"); el_label_size_label.setAttribute("for", "edit_for_label_size"); el_label_size_label.innerHTML = "Field label size(px) "; var el_label_size = document.createElement('input'); el_label_size.setAttribute("id", "edit_for_label_size"); el_label_size.setAttribute("type", "text"); el_label_size.setAttribute("value", w_field_label_size); el_label_size.setAttribute("onKeyPress", "return check_isnum(event)"); el_label_size.setAttribute("onKeyUp", "change_w_style('"+i+"_label_sectionform_id_temp', this.value)"); var el_label_position_label = document.createElement('label'); el_label_position_label.setAttribute("class", "fm-field-label"); el_label_position_label.setAttribute("for", "edit_for_label_position_top"); el_label_position_label.innerHTML = "Field label position"; var el_label_position1 = document.createElement('input'); el_label_position1.setAttribute("id", "edit_for_label_position_top"); el_label_position1.setAttribute("type", "radio"); el_label_position1.setAttribute("value", "left"); el_label_position1.setAttribute("name", "edit_for_label_position"); el_label_position1.setAttribute("onchange", "label_left("+i+")"); Left = document.createTextNode("Left"); var el_label_position2 = document.createElement('input'); el_label_position2.setAttribute("id", "edit_for_label_position_left"); el_label_position2.setAttribute("type", "radio"); el_label_position2.setAttribute("value", "top"); el_label_position2.setAttribute("name", "edit_for_label_position"); el_label_position2.setAttribute("onchange", "label_top("+i+")"); Top = document.createTextNode("Top"); if(w_field_label_pos=="top") el_label_position2.setAttribute("checked", "checked"); else el_label_position1.setAttribute("checked", "checked"); var el_size_label = document.createElement('label'); el_size_label.style.cssText ="color:#000; font-weight:bold; font-size: 13px"; el_size_label.innerHTML = "Field size(px) "; var el_size_w = document.createElement('input'); el_size_w.setAttribute("id", "edit_for_input_size"); el_size_w.setAttribute("type", "text"); el_size_w.setAttribute("value", w_size_w); el_size_w.style.cssText = "margin-right:2px; width: 60px"; el_size_w.setAttribute("name", "edit_for_size"); el_size_w.setAttribute("onKeyPress", "return check_isnum(event)"); el_size_w.setAttribute("onKeyUp", "change_w_style('"+i+"_elementform_id_temp', this.value)"); X = document.createTextNode("x"); var el_size_h = document.createElement('input'); el_size_h.setAttribute("id", "edit_for_input_size"); el_size_h.setAttribute("type", "text"); el_size_h.setAttribute("value", w_size_h); el_size_h.style.cssText = "margin-left:2px; width:60px"; el_size_h.setAttribute("name", "edit_for_size"); el_size_h.setAttribute("onKeyPress", "return check_isnum(event)"); el_size_h.setAttribute("onKeyUp", "change_h_style('"+i+"_elementform_id_temp', this.value)"); var el_first_value_label = document.createElement('label'); el_first_value_label.style.cssText ="color:#000; font-weight:bold; font-size: 13px"; el_first_value_label.innerHTML = "Placeholder"; var el_first_value_input = document.createElement('input'); el_first_value_input.setAttribute("id", "el_first_value_input"); el_first_value_input.setAttribute("type", "text"); el_first_value_input.setAttribute("value", w_title); el_first_value_input.setAttribute("onKeyUp", "change_input_value(this.value,'"+i+"_elementform_id_temp')"); var el_required_label = document.createElement('label'); el_required_label.setAttribute("class", "fm-field-label"); el_required_label.setAttribute("for", "el_send"); el_required_label.innerHTML = "Required"; var el_required = document.createElement('input'); el_required.setAttribute("id", "el_send"); el_required.setAttribute("type", "checkbox"); el_required.setAttribute("value", "yes"); el_required.setAttribute("onclick", "set_required('"+i+"_required')"); if(w_required=="yes") el_required.setAttribute("checked", "checked"); var el_style_label = document.createElement('label'); el_style_label.setAttribute("class", "fm-field-label"); el_style_label.setAttribute("for", "element_style"); el_style_label.innerHTML = "Class name"; var el_style_textarea = document.createElement('input'); el_style_textarea.setAttribute("id", "element_style"); el_style_textarea.setAttribute("type", "text"); el_style_textarea.setAttribute("value", w_class); el_style_textarea.setAttribute("onChange", "change_class(this.value,'"+i+"')"); var el_attr_label = document.createElement('label'); el_attr_label.setAttribute("class", "fm-field-label"); el_attr_label.setAttribute("for", "el_choices_add"); el_attr_label.innerHTML = "Additional Attributes"; var el_attr_add = document.createElement('img'); el_attr_add.setAttribute("id", "el_choices_add"); el_attr_add.setAttribute("src", plugin_url + '/images/add.png?ver=1.8.0'); el_attr_add.style.cssText = 'cursor:pointer; margin-left:68px'; el_attr_add.setAttribute("title", 'add'); el_attr_add.setAttribute("onClick", "add_attr("+i+", 'type_text')"); var el_attr_table = document.createElement('table'); el_attr_table.setAttribute("id", 'attributes'); el_attr_table.setAttribute("border", '0'); el_attr_table.style.cssText = 'margin-left:0px'; var el_attr_tr_label = document.createElement('tr'); el_attr_tr_label.setAttribute("idi", '0'); var el_attr_td_name_label = document.createElement('th'); el_attr_td_name_label.style.cssText = 'width:100px'; var el_attr_td_value_label = document.createElement('th'); el_attr_td_value_label.style.cssText = 'width:100px'; var el_attr_td_X_label = document.createElement('th'); el_attr_td_X_label.style.cssText = 'width:10px'; var el_attr_name_label = document.createElement('label'); el_attr_name_label.style.cssText ="color:#000; font-weight:bold; font-size: 11px"; el_attr_name_label.innerHTML = "Name"; var el_attr_value_label = document.createElement('label'); el_attr_value_label.style.cssText ="color:#000; font-weight:bold; font-size: 11px"; el_attr_value_label.innerHTML = "Value"; el_attr_table.appendChild(el_attr_tr_label); el_attr_tr_label.appendChild(el_attr_td_name_label); el_attr_tr_label.appendChild(el_attr_td_value_label); el_attr_tr_label.appendChild(el_attr_td_X_label); el_attr_td_name_label.appendChild(el_attr_name_label); el_attr_td_value_label.appendChild(el_attr_value_label); n=w_attr_name.length; for(j=1; j<=n; j++) { var el_attr_tr = document.createElement('tr'); el_attr_tr.setAttribute("id", "attr_row_"+j); el_attr_tr.setAttribute("idi", j); var el_attr_td_name = document.createElement('td'); el_attr_td_name.style.cssText = 'width:100px'; var el_attr_td_value = document.createElement('td'); el_attr_td_value.style.cssText = 'width:100px'; var el_attr_td_X = document.createElement('td'); var el_attr_name = document.createElement('input'); el_attr_name.setAttribute("type", "text"); el_attr_name.setAttribute("class", "fm-field-choice"); el_attr_name.setAttribute("value", w_attr_name[j-1]); el_attr_name.setAttribute("id", "attr_name"+j); el_attr_name.setAttribute("onChange", "change_attribute_name("+i+", this, 'type_text')"); var el_attr_value = document.createElement('input'); el_attr_value.setAttribute("type", "text"); el_attr_value.setAttribute("class", "fm-field-choice"); el_attr_value.setAttribute("value", w_attr_value[j-1]); el_attr_value.setAttribute("id", "attr_value"+j); el_attr_value.setAttribute("onChange", "change_attribute_value("+i+", "+j+", 'type_text')"); var el_attr_remove = document.createElement('img'); el_attr_remove.setAttribute("id", "el_choices"+j+"_remove"); el_attr_remove.setAttribute("src", plugin_url + '/images/delete.png?ver=1.8.0'); el_attr_remove.style.cssText = 'cursor:pointer; vertical-align:middle; margin:2px'; el_attr_remove.setAttribute("align", 'top'); el_attr_remove.setAttribute("onClick", "remove_attr("+j+", "+i+", 'type_text')"); el_attr_table.appendChild(el_attr_tr); el_attr_tr.appendChild(el_attr_td_name); el_attr_tr.appendChild(el_attr_td_value); el_attr_tr.appendChild(el_attr_td_X); el_attr_td_name.appendChild(el_attr_name); el_attr_td_value.appendChild(el_attr_value); el_attr_td_X.appendChild(el_attr_remove); } var t = document.getElementById('edit_table'); var br = document.createElement('br'); var br1 = document.createElement('br'); var br2 = document.createElement('br'); var br3 = document.createElement('br'); var br4 = document.createElement('br'); var br5 = document.createElement('br'); var br6 = document.createElement('br'); edit_main_td1.appendChild(el_label_label); edit_main_td1_1.appendChild(el_label_textarea); edit_main_td8.appendChild(el_label_size_label); edit_main_td8_1.appendChild(el_label_size); edit_main_td2.appendChild(el_label_position_label); edit_main_td2_1.appendChild(el_label_position1); edit_main_td2_1.appendChild(el_label_left); edit_main_td2_1.appendChild(br); edit_main_td2_1.appendChild(el_label_position2); edit_main_td2_1.appendChild(el_label_top); edit_main_td3.appendChild(el_size_label); edit_main_td3_1.appendChild(el_size_w); edit_main_td3_1.appendChild(X); edit_main_td3_1.appendChild(el_size_h); edit_main_td4.appendChild(el_first_value_label); edit_main_td4_1.appendChild(el_first_value_input); edit_main_td5.appendChild(el_style_label); edit_main_td5_1.appendChild(el_style_textarea); edit_main_td6.appendChild(el_required_label); edit_main_td6_1.appendChild(el_required); edit_main_td7.appendChild(el_attr_label); edit_main_td7.appendChild(el_attr_add); edit_main_td7.appendChild(br6); edit_main_td7.appendChild(el_attr_table); edit_main_td7.setAttribute("colspan", "2"); edit_main_tr1.appendChild(edit_main_td1); edit_main_tr1.appendChild(edit_main_td1_1); edit_main_tr8.appendChild(edit_main_td8); edit_main_tr8.appendChild(edit_main_td8_1); edit_main_tr2.appendChild(edit_main_td2); edit_main_tr2.appendChild(edit_main_td2_1); edit_main_tr3.appendChild(edit_main_td3); edit_main_tr3.appendChild(edit_main_td3_1); edit_main_tr4.appendChild(edit_main_td4); edit_main_tr4.appendChild(edit_main_td4_1); edit_main_tr5.appendChild(edit_main_td5); edit_main_tr5.appendChild(edit_main_td5_1); edit_main_tr6.appendChild(edit_main_td6); edit_main_tr6.appendChild(edit_main_td6_1); edit_main_tr7.appendChild(edit_main_td7); edit_main_tr7.appendChild(edit_main_td7_1); edit_main_table.appendChild(edit_main_tr1); edit_main_table.appendChild(edit_main_tr8); edit_main_table.appendChild(edit_main_tr2); edit_main_table.appendChild(edit_main_tr3); edit_main_table.appendChild(edit_main_tr4); edit_main_table.appendChild(edit_main_tr5); edit_main_table.appendChild(edit_main_tr6); edit_main_table.appendChild(edit_main_tr7); edit_div.appendChild(edit_main_table); t.appendChild(edit_div); add_id_and_name(i, 'type_text'); //show table element='editor'; var adding_type = document.createElement("input"); adding_type.setAttribute("type", "hidden"); adding_type.setAttribute("value", "type_wdeditor"); adding_type.setAttribute("name", i+"_typeform_id_temp"); adding_type.setAttribute("id", i+"_typeform_id_temp"); var adding_required= document.createElement("input"); adding_required.setAttribute("type", "hidden"); adding_required.setAttribute("value", w_required); adding_required.setAttribute("name", i+"_requiredform_id_temp"); adding_required.setAttribute("id", i+"_requiredform_id_temp"); var div = document.createElement('div'); div.setAttribute("id", "main_div"); var div_field = document.createElement('div'); div_field.setAttribute("id", i+"_elemet_tableform_id_temp"); var div_label = document.createElement('div'); div_label.setAttribute("align", 'left'); div_label.style.display="table-cell"; div_label.style.width=w_field_label_size+"px"; div_label.setAttribute("id", i+"_label_sectionform_id_temp"); var div_element = document.createElement('div'); div_element.setAttribute("align", 'left'); div_element.style.display="table-cell"; div_element.setAttribute("id", i+"_element_sectionform_id_temp"); var br1 = document.createElement('br'); var br2 = document.createElement('br'); var br3 = document.createElement('br'); var br4 = document.createElement('br'); var label = document.createElement('span'); label.setAttribute("id", i+"_element_labelform_id_temp"); label.innerHTML = w_field_label; label.setAttribute("class", "label"); var required = document.createElement('span'); required.setAttribute("id", i+"_required_elementform_id_temp"); required.innerHTML = ""; required.setAttribute("class", "required"); if(w_required=="yes") required.innerHTML = " *"; var adding = document.createElement('input'); adding.setAttribute("id", i+"_elementform_id_temp"); adding.setAttribute("name", i+"_elementform_id_temp"); adding.setAttribute("type", "hidden"); adding.style.width = w_size_w+"px"; adding.style.height = w_size_h+"px"; adding.setAttribute("title", w_title); var adding_text = document.createElement('span'); adding_text.style.color="red"; adding_text.style.fontStyle="italic"; adding_text.innerHTML="Editor doesn't display in back end"; Left = document.createTextNode(i+"_editorform_id_temp"); var div_for_editor = document.createElement('div'); div_for_editor.style.display="none"; var main_td = document.getElementById('show_table'); div_label.appendChild(label); div_label.appendChild(required); div_element.appendChild(adding_type); div_element.appendChild(adding_required); div_element.appendChild(adding); div_element.appendChild(adding_text); div_for_editor.appendChild(Left); div_element.appendChild(div_for_editor); div_field.appendChild(div_label); div_field.appendChild(div_element); div.appendChild(div_field); div.appendChild(br3); main_td.appendChild(div); if(w_field_label_pos=="top") label_top(i); change_class(w_class, i); refresh_attr(i, 'type_text'); } function change_input_range(type, id) { var s=''; if(document.getElementById('el_range_'+type+'1').value!='') s=document.getElementById('el_range_'+type+'1').value; if(document.getElementById('el_range_'+type+'2').value!='') { if(document.getElementById('el_range_'+type+'1').value=='') s='0'; s=s+'.'+document.getElementById('el_range_'+type+'2').value; } document.getElementById(id+'_range_'+type+'form_id_temp').value=s; } function explode( delimiter, string ) { var emptyArray = { 0: '' }; if ( arguments.length != 2 || typeof arguments[0] == 'undefined' || typeof arguments[1] == 'undefined' ) { return null; } if ( delimiter === '' || delimiter === false || delimiter === null ) { return false; } if ( typeof delimiter == 'function' || typeof delimiter == 'object' || typeof string == 'function' || typeof string == 'object' ) { return emptyArray; } if ( delimiter === true ) { delimiter = '1'; } return string.toString().split ( delimiter.toString() ); } function type_paypal_price(i, w_field_label, w_field_label_size, w_field_label_pos, w_first_val, w_title, w_mini_labels, w_size, w_required, w_hide_cents, w_class, w_attr_name, w_attr_value, w_range_min, w_range_max) { document.getElementById("element_type").value="type_paypal_price"; delete_last_child(); var edit_div = document.createElement('div'); edit_div.setAttribute("id", "edit_div"); var edit_main_table = document.createElement('table'); edit_main_table.setAttribute("id", "edit_main_table"); edit_main_table.setAttribute("cellpadding", "3"); edit_main_table.setAttribute("cellspacing", "0"); var edit_main_tr1 = document.createElement('tr'); var edit_main_tr2 = document.createElement('tr'); var edit_main_tr3 = document.createElement('tr'); var edit_main_tr4 = document.createElement('tr'); var edit_main_tr5 = document.createElement('tr'); var edit_main_tr6 = document.createElement('tr'); var edit_main_tr7 = document.createElement('tr'); var edit_main_tr8 = document.createElement('tr'); var edit_main_tr9 = document.createElement('tr'); var edit_main_tr10 = document.createElement('tr'); var edit_main_td1 = document.createElement('td'); var edit_main_td1_1 = document.createElement('td'); var edit_main_td2 = document.createElement('td'); var edit_main_td2_1 = document.createElement('td'); var edit_main_td3 = document.createElement('td'); var edit_main_td3_1 = document.createElement('td'); edit_main_td3_1.style.cssText = "line-height:20px"; var edit_main_td4 = document.createElement('td'); var edit_main_td4_1 = document.createElement('td'); var edit_main_td5 = document.createElement('td'); var edit_main_td5_1 = document.createElement('td'); var edit_main_td6 = document.createElement('td'); var edit_main_td6_1 = document.createElement('td'); var edit_main_td7 = document.createElement('td'); var edit_main_td7_1 = document.createElement('td'); var edit_main_td8 = document.createElement('td'); var edit_main_td8_1 = document.createElement('td'); var edit_main_td9 = document.createElement('td'); var edit_main_td9_1 = document.createElement('td'); var edit_main_td10 = document.createElement('td'); var edit_main_td10_1 = document.createElement('td'); var el_label_label = document.createElement('label'); el_label_label.setAttribute("class", "fm-field-label"); el_label_label.setAttribute("for", "edit_for_label"); el_label_label.innerHTML = "Field label"; var el_label_textarea = document.createElement('textarea'); el_label_textarea.setAttribute("id", "edit_for_label"); el_label_textarea.setAttribute("rows", "4"); el_label_textarea.setAttribute("onKeyUp", "change_label('"+i+"_element_labelform_id_temp', this.value)"); el_label_textarea.innerHTML = w_field_label; var el_label_size_label = document.createElement('label'); el_label_size_label.setAttribute("class", "fm-field-label"); el_label_size_label.setAttribute("for", "edit_for_label_size"); el_label_size_label.innerHTML = "Field label size(px) "; var el_label_size = document.createElement('input'); el_label_size.setAttribute("id", "edit_for_label_size"); el_label_size.setAttribute("type", "text"); el_label_size.setAttribute("value", w_field_label_size); el_label_size.setAttribute("onKeyPress", "return check_isnum(event)"); el_label_size.setAttribute("onKeyUp", "change_w_style('"+i+"_label_sectionform_id_temp', this.value)"); var el_label_position_label = document.createElement('label'); el_label_position_label.setAttribute("class", "fm-field-label"); el_label_position_label.innerHTML = "Field label position"; var el_label_position1 = document.createElement('input'); el_label_position1.setAttribute("id", "edit_for_label_position_top"); el_label_position1.setAttribute("type", "radio"); el_label_position1.setAttribute("name", "edit_for_label_position"); el_label_position1.setAttribute("onchange", "label_left("+i+")"); var el_label_left = document.createElement('label'); el_label_left.setAttribute("for", "edit_for_label_position_top"); el_label_left.innerHTML = "Left"; var el_label_position2 = document.createElement('input'); el_label_position2.setAttribute("id", "edit_for_label_position_left"); el_label_position2.setAttribute("type", "radio"); el_label_position2.setAttribute("name", "edit_for_label_position"); el_label_position2.setAttribute("onchange", "label_top("+i+")"); var el_label_top = document.createElement('label'); el_label_top.setAttribute("for", "edit_for_label_position_left"); el_label_top.innerHTML = "Top"; if(w_field_label_pos=="top") el_label_position2.setAttribute("checked", "checked"); else el_label_position1.setAttribute("checked", "checked"); w_range_minarray = explode('.', w_range_min); w_range_maxarray = explode('.', w_range_max); var el_range_label = document.createElement('label'); el_range_label.setAttribute("class", "fm-field-label"); el_range_label.innerHTML = "Range "; var min = document.createTextNode("Min"); var el_range_min1 = document.createElement('input'); el_range_min1.setAttribute("type", "text"); el_range_min1.setAttribute("id", "el_range_min1"); if(w_range_minarray[0]) el_range_min1.setAttribute("value", w_range_minarray[0]); el_range_min1.style.cssText = "width:60px; margin-right:4px;margin-left:8px"; el_range_min1.setAttribute("onKeyPress", "return check_isnum(event)"); el_range_min1.setAttribute("onChange", "change_input_range('min', '"+i+"')"); var ket_min = document.createTextNode("."); var el_range_min2 = document.createElement('input'); el_range_min2.setAttribute("type", "text"); el_range_min2.setAttribute("id", "el_range_min2"); if(w_range_minarray[1]) el_range_min2.setAttribute("value", w_range_minarray[1]); el_range_min2.style.cssText = "width:30px; margin-left:4px"; el_range_min2.setAttribute("onKeyPress", "return check_isnum(event)"); el_range_min2.setAttribute("onChange", "change_input_range('min', '"+i+"')"); var max = document.createTextNode("Max"); var el_range_max1 = document.createElement('input'); el_range_max1.setAttribute("type", "text"); el_range_max1.setAttribute("id", "el_range_max1"); if(w_range_maxarray[0]) el_range_max1.setAttribute("value", w_range_maxarray[0]); el_range_max1.style.cssText = "width:60px; margin-right:4px; margin-left:7px"; el_range_max1.setAttribute("onKeyPress", "return check_isnum(event)"); el_range_max1.setAttribute("onChange", "change_input_range('max', '"+i+"')"); var ket_max = document.createTextNode("."); var el_range_max2 = document.createElement('input'); el_range_max2.setAttribute("type", "text"); el_range_max2.setAttribute("id", "el_range_max2"); if(w_range_maxarray[1]) el_range_max2.setAttribute("value", w_range_maxarray[1]); el_range_max2.style.cssText = "width:30px; margin-left:4px"; el_range_max2.setAttribute("onKeyPress", "return check_isnum(event)"); el_range_max2.setAttribute("onChange", "change_input_range('max', '"+i+"')"); var gic = document.createTextNode("-"); var el_first_value_label = document.createElement('label'); el_first_value_label.setAttribute("class", "fm-field-label"); el_first_value_label.setAttribute("for", "el_first_value_first"); el_first_value_label.innerHTML = "Placeholder "; var el_first_value_first = document.createElement('input'); el_first_value_first.setAttribute("id", "el_first_value_first"); el_first_value_first.setAttribute("type", "text"); el_first_value_first.setAttribute("value", w_title[0]); el_first_value_first.style.cssText = "width:120px; margin-right:4px"; el_first_value_first.setAttribute("onKeyPress", "return check_isnum(event)"); el_first_value_first.setAttribute("onKeyUp", "change_input_value(this.value,'"+i+"_element_dollarsform_id_temp')"); var el_first_value_last = document.createElement('input'); el_first_value_last.setAttribute("id", "el_first_value_last"); el_first_value_last.setAttribute("type", "text"); el_first_value_last.setAttribute("value", w_title[1]); el_first_value_last.style.cssText = "width:67px; margin-left:4px; margin-right:4px"; el_first_value_last.setAttribute("onKeyPress", "return check_isnum_interval(event,'"+i+"_element_centsform_id_temp',0,99)"); el_first_value_last.setAttribute("onKeyUp", "change_input_value(this.value,'"+i+"_element_centsform_id_temp')"); var el_size_label = document.createElement('label'); el_size_label.setAttribute("class", "fm-field-label"); el_size_label.setAttribute("for", "edit_for_input_size"); el_size_label.innerHTML = "Field size(px) "; var el_size = document.createElement('input'); el_size.setAttribute("id", "edit_for_input_size"); el_size.setAttribute("type", "text"); el_size.setAttribute("value", w_size); el_size.setAttribute("onKeyPress", "return check_isnum(event)"); el_size.setAttribute("onKeyUp", "change_w_style('"+i+"_element_dollarsform_id_temp', this.value);"); var el_required_label = document.createElement('label'); el_required_label.setAttribute("class", "fm-field-label"); el_required_label.setAttribute("for", "el_required"); el_required_label.innerHTML = "Required"; var el_required = document.createElement('input'); el_required.setAttribute("id", "el_required"); el_required.setAttribute("type", "checkbox"); el_required.setAttribute("onclick", "set_required('"+i+"_required')"); if(w_required=="yes") el_required.setAttribute("checked", "checked"); var el_hide_cents_label = document.createElement('label'); el_hide_cents_label.setAttribute("class", "fm-field-label"); el_hide_cents_label.setAttribute("for", "el_hide_cents"); el_hide_cents_label.innerHTML = "Hide Cents"; var el_hide_cents = document.createElement('input'); el_hide_cents.setAttribute("id", "el_hide_cents"); el_hide_cents.setAttribute("type", "checkbox"); el_hide_cents.setAttribute("onclick", "hide_show_cents(this.checked, "+i+")"); if(w_hide_cents=="yes") el_hide_cents.setAttribute("checked", "checked"); var el_style_label = document.createElement('label'); el_style_label.setAttribute("class", "fm-field-label"); el_style_label.setAttribute("for", "el_style_textarea"); el_style_label.innerHTML = "Class name"; var el_style_textarea = document.createElement('input'); el_style_textarea.setAttribute("id", "el_style_textarea"); el_style_textarea.setAttribute("type", "text"); el_style_textarea.setAttribute("value", w_class); el_style_textarea.setAttribute("onChange", "change_class(this.value,'"+i+"')"); var el_attr_label = document.createElement('label'); el_attr_label.setAttribute("class", "fm-field-label"); el_attr_label.innerHTML = "Additional Attributes"; var el_attr_add = document.createElement('img'); el_attr_add.setAttribute("src", plugin_url + '/images/add.png?ver=1.8.0'); el_attr_add.style.cssText = 'cursor:pointer; margin-left:68px'; el_attr_add.setAttribute("title", 'add'); el_attr_add.setAttribute("onClick", "add_attr("+i+", 'type_paypal_price')"); var el_attr_table = document.createElement('table'); el_attr_table.setAttribute("id", 'attributes'); el_attr_table.setAttribute("border", '0'); el_attr_table.style.cssText = 'margin-left:0px'; var el_attr_tr_label = document.createElement('tr'); el_attr_tr_label.setAttribute("idi", '0'); var el_attr_td_name_label = document.createElement('th'); el_attr_td_name_label.style.cssText = 'width:100px'; var el_attr_td_value_label = document.createElement('th'); el_attr_td_value_label.style.cssText = 'width:100px'; var el_attr_td_X_label = document.createElement('th'); el_attr_td_X_label.style.cssText = 'width:10px'; var el_attr_name_label = document.createElement('label'); el_attr_name_label.style.cssText ="color:#000; font-weight:bold; font-size: 11px"; el_attr_name_label.innerHTML = "Name"; var el_attr_value_label = document.createElement('label'); el_attr_value_label.style.cssText ="color:#000; font-weight:bold; font-size: 11px"; el_attr_value_label.innerHTML = "Value"; el_attr_table.appendChild(el_attr_tr_label); el_attr_tr_label.appendChild(el_attr_td_name_label); el_attr_tr_label.appendChild(el_attr_td_value_label); el_attr_tr_label.appendChild(el_attr_td_X_label); el_attr_td_name_label.appendChild(el_attr_name_label); el_attr_td_value_label.appendChild(el_attr_value_label); n=w_attr_name.length; for(j=1; j<=n; j++) { var el_attr_tr = document.createElement('tr'); el_attr_tr.setAttribute("id", "attr_row_"+j); el_attr_tr.setAttribute("idi", j); var el_attr_td_name = document.createElement('td'); el_attr_td_name.style.cssText = 'width:100px'; var el_attr_td_value = document.createElement('td'); el_attr_td_value.style.cssText = 'width:100px'; var el_attr_td_X = document.createElement('td'); var el_attr_name = document.createElement('input'); el_attr_name.setAttribute("type", "text"); el_attr_name.setAttribute("class", "fm-field-choice"); el_attr_name.setAttribute("value", w_attr_name[j-1]); el_attr_name.setAttribute("id", "attr_name"+j); el_attr_name.setAttribute("onChange", "change_attribute_name("+i+", this, 'type_paypal_price')"); var el_attr_value = document.createElement('input'); el_attr_value.setAttribute("type", "text"); el_attr_value.setAttribute("class", "fm-field-choice"); el_attr_value.setAttribute("value", w_attr_value[j-1]); el_attr_value.setAttribute("id", "attr_value"+j); el_attr_value.setAttribute("onChange", "change_attribute_value("+i+", "+j+", 'type_paypal_price')"); var el_attr_remove = document.createElement('img'); el_attr_remove.setAttribute("id", "el_choices"+j+"_remove"); el_attr_remove.setAttribute("src", plugin_url + '/images/delete.png?ver=1.8.0'); el_attr_remove.style.cssText = 'cursor:pointer; vertical-align:middle; margin:2px'; el_attr_remove.setAttribute("onClick", "remove_attr("+j+", "+i+", 'type_paypal_price')"); el_attr_table.appendChild(el_attr_tr); el_attr_tr.appendChild(el_attr_td_name); el_attr_tr.appendChild(el_attr_td_value); el_attr_tr.appendChild(el_attr_td_X); el_attr_td_name.appendChild(el_attr_name); el_attr_td_value.appendChild(el_attr_value); el_attr_td_X.appendChild(el_attr_remove); } var t = document.getElementById('edit_table'); var br = document.createElement('br'); var br1 = document.createElement('br'); var br2 = document.createElement('br'); var br3 = document.createElement('br'); var br4 = document.createElement('br'); var br5 = document.createElement('br'); var br6 = document.createElement('br'); edit_main_td1.appendChild(el_label_label); edit_main_td1_1.appendChild(el_label_textarea); edit_main_td10.appendChild(el_label_size_label); edit_main_td10_1.appendChild(el_label_size); edit_main_td2.appendChild(el_label_position_label); edit_main_td2_1.appendChild(el_label_position1); edit_main_td2_1.appendChild(el_label_left); edit_main_td2_1.appendChild(br); edit_main_td2_1.appendChild(el_label_position2); edit_main_td2_1.appendChild(el_label_top); edit_main_td3.appendChild(el_range_label); edit_main_td3_1.appendChild(min); edit_main_td3_1.appendChild(el_range_min1); edit_main_td3_1.appendChild(ket_min); edit_main_td3_1.appendChild(el_range_min2); edit_main_td3_1.appendChild(br1); edit_main_td3_1.appendChild(max); edit_main_td3_1.appendChild(el_range_max1); edit_main_td3_1.appendChild(ket_max); edit_main_td3_1.appendChild(el_range_max2); edit_main_td9.appendChild(el_first_value_label); edit_main_td9_1.appendChild(el_first_value_first); edit_main_td9_1.appendChild(gic); edit_main_td9_1.appendChild(el_first_value_last); edit_main_td7.appendChild(el_size_label); edit_main_td7_1.appendChild(el_size); edit_main_td4.appendChild(el_style_label); edit_main_td4_1.appendChild(el_style_textarea); edit_main_td5.appendChild(el_required_label); edit_main_td5_1.appendChild(el_required); edit_main_td8.appendChild(el_hide_cents_label); edit_main_td8_1.appendChild(el_hide_cents); edit_main_td6.appendChild(el_attr_label); edit_main_td6.appendChild(el_attr_add); edit_main_td6.appendChild(br3); edit_main_td6.appendChild(el_attr_table); edit_main_td6.setAttribute("colspan", "2"); edit_main_tr1.appendChild(edit_main_td1); edit_main_tr1.appendChild(edit_main_td1_1); edit_main_tr10.appendChild(edit_main_td10); edit_main_tr10.appendChild(edit_main_td10_1); edit_main_tr2.appendChild(edit_main_td2); edit_main_tr2.appendChild(edit_main_td2_1); edit_main_tr3.appendChild(edit_main_td3); edit_main_tr3.appendChild(edit_main_td3_1); edit_main_tr7.appendChild(edit_main_td7); edit_main_tr7.appendChild(edit_main_td7_1); edit_main_tr4.appendChild(edit_main_td4); edit_main_tr4.appendChild(edit_main_td4_1); edit_main_tr5.appendChild(edit_main_td5); edit_main_tr5.appendChild(edit_main_td5_1); edit_main_tr6.appendChild(edit_main_td6); edit_main_tr6.appendChild(edit_main_td6_1); edit_main_tr8.appendChild(edit_main_td8); edit_main_tr8.appendChild(edit_main_td8_1); edit_main_tr9.appendChild(edit_main_td9); edit_main_tr9.appendChild(edit_main_td9_1); edit_main_table.appendChild(edit_main_tr1); edit_main_table.appendChild(edit_main_tr10); edit_main_table.appendChild(edit_main_tr2); edit_main_table.appendChild(edit_main_tr3); edit_main_table.appendChild(edit_main_tr9); edit_main_table.appendChild(edit_main_tr7); edit_main_table.appendChild(edit_main_tr4); edit_main_table.appendChild(edit_main_tr5); edit_main_table.appendChild(edit_main_tr8); edit_main_table.appendChild(edit_main_tr6); edit_div.appendChild(edit_main_table); t.appendChild(edit_div); add_id_and_name(i, 'type_name'); //show table var adding_type = document.createElement("input"); adding_type.setAttribute("type", "hidden"); adding_type.setAttribute("value", "type_paypal_price"); adding_type.setAttribute("name", i+"_typeform_id_temp"); adding_type.setAttribute("id", i+"_typeform_id_temp"); var adding_required= document.createElement("input"); adding_required.setAttribute("type", "hidden"); adding_required.setAttribute("value", w_required); adding_required.setAttribute("name", i+"_requiredform_id_temp"); adding_required.setAttribute("id", i+"_requiredform_id_temp"); var adding_range_min= document.createElement("input"); adding_range_min.setAttribute("type", "hidden"); adding_range_min.setAttribute("value", w_range_min); adding_range_min.setAttribute("name", i+"_range_minform_id_temp"); adding_range_min.setAttribute("id", i+"_range_minform_id_temp"); var adding_range_max= document.createElement("input"); adding_range_max.setAttribute("type", "hidden"); adding_range_max.setAttribute("value", w_range_max); adding_range_max.setAttribute("name", i+"_range_maxform_id_temp"); adding_range_max.setAttribute("id", i+"_range_maxform_id_temp"); var div = document.createElement('div'); div.setAttribute("id", "main_div"); var div_for_editable_labels = document.createElement('div'); div_for_editable_labels.setAttribute("class", "fm-editable-label"); edit_labels = document.createTextNode("The labels of the fields are editable. Please, click on the label to edit."); div_for_editable_labels.appendChild(edit_labels); var div_field = document.createElement('div'); div_field.setAttribute("id", i+"_elemet_tableform_id_temp"); var div_label = document.createElement('div'); div_label.setAttribute("align", 'left'); div_label.style.display="table-cell"; div_label.style.width=w_field_label_size+"px"; div_label.setAttribute("id", i+"_label_sectionform_id_temp"); var div_element = document.createElement('div'); div_element.setAttribute("align", 'left'); div_element.style.display="table-cell"; div_element.setAttribute("id", i+"_element_sectionform_id_temp"); var table_price = document.createElement('div'); table_price.setAttribute("id", i+"_table_price"); table_price.style.display="table"; var tr_price1 = document.createElement('div'); tr_price1.setAttribute("id", i+"_tr_price1"); tr_price1.style.display="table-row"; var tr_price2 = document.createElement('div'); tr_price2.setAttribute("id", i+"_tr_price2"); tr_price2.style.display="table-row"; var td_name_currency = document.createElement('div'); td_name_currency.setAttribute("id", i+"_td_name_currency"); td_name_currency.style.display="table-cell"; var td_name_dollars = document.createElement('div'); td_name_dollars.setAttribute("id", i+"_td_name_dollars"); td_name_dollars.style.display="table-cell"; var td_name_ket = document.createElement('div'); td_name_ket.setAttribute("id", i+"_td_name_divider"); td_name_ket.style.display="table-cell"; var td_name_cents = document.createElement('div'); td_name_cents.setAttribute("id", i+"_td_name_cents"); td_name_cents.style.display="table-cell"; var td_name_label_currency = document.createElement('div'); td_name_label_currency.style.display="table-cell"; var td_name_label_dollars = document.createElement('div'); td_name_label_dollars.setAttribute("align", "left"); td_name_label_dollars.style.display="table-cell"; var td_name_label_ket = document.createElement('div'); td_name_label_ket.setAttribute("id", i+"_td_name_label_divider"); td_name_label_ket.style.display="table-cell"; var td_name_label_cents = document.createElement('div'); td_name_label_cents.setAttribute("align", "left"); td_name_label_cents.setAttribute("id", i+"_td_name_label_cents"); td_name_label_cents.style.display="table-cell"; var label = document.createElement('span'); label.setAttribute("id", i+"_element_labelform_id_temp"); label.innerHTML = w_field_label; label.setAttribute("class", "label"); label.style.verticalAlign="top"; var required = document.createElement('span'); required.setAttribute("id", i+"_required_elementform_id_temp"); required.innerHTML = ""; required.setAttribute("class", "required"); required.style.verticalAlign="top"; if(w_required=="yes") required.innerHTML = " *"; var currency = document.createElement('span'); currency.setAttribute("class", 'wdform_colon'); currency.style.cssText = "font-style:bold; vertical-align:middle"; currency.innerHTML=" $ "; var currency_label = document.createElement('label'); currency_label.setAttribute("class", "mini_label"); var dollars = document.createElement('input'); dollars.setAttribute("type", 'text'); dollars.style.cssText = "width:"+w_size+"px"; dollars.setAttribute("id", i+"_element_dollarsform_id_temp"); dollars.setAttribute("name", i+"_element_dollarsform_id_temp"); dollars.setAttribute("value", w_first_val[0]); dollars.setAttribute("title", w_title[0]); dollars.setAttribute("onKeyPress", "return check_isnum(event)"); var dollars_label = document.createElement('label'); dollars_label.setAttribute("class", "mini_label"); dollars_label.setAttribute("id", i+"_mini_label_dollars"); dollars_label.innerHTML= w_mini_labels[0]; var ket = document.createElement('span'); ket.setAttribute("class", 'wdform_colon'); ket.style.cssText = "font-style:bold; vertical-align:middle"; ket.innerHTML=" . "; var ket_label = document.createElement('label'); ket_label.setAttribute("class", "mini_label"); var cents = document.createElement('input'); cents.setAttribute("type", 'text'); cents.style.cssText = "width:30px"; cents.setAttribute("id", i+"_element_centsform_id_temp"); cents.setAttribute("name", i+"_element_centsform_id_temp"); cents.setAttribute("value", w_first_val[1]); cents.setAttribute("title", w_title[1]); cents.setAttribute("onBlur", 'add_0("'+i+'_element_centsform_id_temp")'); cents.setAttribute("onKeyPress", "return check_isnum_interval(event,'"+i+"_element_centsform_id_temp',0,99)"); var cents_label = document.createElement('label'); cents_label.setAttribute("class", "mini_label"); cents_label.setAttribute("id", i+"_mini_label_cents"); cents_label.innerHTML= w_mini_labels[1]; var main_td = document.getElementById('show_table'); div_label.appendChild(label); div_label.appendChild(required ); td_name_currency.appendChild(currency); td_name_dollars.appendChild(dollars); td_name_ket.appendChild(ket); td_name_cents.appendChild(cents); tr_price1.appendChild(td_name_currency); tr_price1.appendChild(td_name_dollars); tr_price1.appendChild(td_name_ket); tr_price1.appendChild(td_name_cents); td_name_label_currency.appendChild(currency_label); td_name_label_dollars.appendChild(dollars_label); td_name_label_ket.appendChild(ket_label); td_name_label_cents.appendChild(cents_label); tr_price2.appendChild(td_name_label_currency); tr_price2.appendChild(td_name_label_dollars); tr_price2.appendChild(td_name_label_ket); tr_price2.appendChild(td_name_label_cents); table_price.appendChild(tr_price1); table_price.appendChild(tr_price2); div_element.appendChild(adding_type); div_element.appendChild(adding_required); div_element.appendChild(adding_range_min); div_element.appendChild(adding_range_max); div_element.appendChild(table_price); div_field.appendChild(div_label); div_field.appendChild(div_element); div.appendChild(div_field); div.appendChild(br3); div.appendChild(div_for_editable_labels); main_td.appendChild(div); if(w_field_label_pos=="top") label_top(i); if(w_hide_cents=="yes") hide_show_cents(true, i) change_class(w_class, i); refresh_attr(i, 'type_paypal_price'); jQuery(document).ready(function() { jQuery("label#"+i+"_mini_label_dollars").on("click", function() { if (jQuery(this).children('input').length == 0) { var dollars = ""; jQuery(this).html(dollars); jQuery(dollars).focus(); jQuery("input.dollars").blur(function() { var value = jQuery(this).val(); jQuery("#"+i+"_mini_label_dollars").text(value); }); } }); jQuery("label#"+i+"_mini_label_cents").on("click", function() { if (jQuery(this).children('input').length == 0) { var cents = ""; jQuery(this).html(cents); jQuery("input.cents").focus(); jQuery("input.cents").blur(function() { var value = jQuery(this).val(); jQuery("#"+i+"_mini_label_cents").text(value); }); } }); }); } function hide_show_cents(hide, id) { td_divider =document.getElementById(id+"_td_name_divider"); td_cents =document.getElementById(id+"_td_name_cents"); td_divider_label =document.getElementById(id+"_td_name_label_divider"); td_cents_label =document.getElementById(id+"_td_name_label_cents"); change_input_value('',id+'_element_centsform_id_temp'); document.getElementById("el_first_value_last").value=""; document.getElementById(id+'_element_centsform_id_temp').value=""; if(hide) { td_divider.style.display="none"; td_cents.style.display="none"; td_divider_label.style.display="none"; td_cents_label.style.display="none"; } else { td_divider.style.display="table-cell"; td_cents.style.display="table-cell"; td_divider_label.style.display="table-cell"; td_cents_label.style.display="table-cell"; } } function type_date(i, w_field_label, w_field_label_size, w_field_label_pos, w_date, w_required, w_class, w_format, w_but_val, w_attr_name, w_attr_value,w_disable_past_days) { document.getElementById("element_type").value="type_date"; delete_last_child(); var edit_div = document.createElement('div'); edit_div.setAttribute("id", "edit_div"); var edit_main_table = document.createElement('table'); edit_main_table.setAttribute("id", "edit_main_table"); edit_main_table.setAttribute("cellpadding", "3"); edit_main_table.setAttribute("cellspacing", "0"); var edit_main_tr1 = document.createElement('tr'); var edit_main_tr2 = document.createElement('tr'); var edit_main_tr3 = document.createElement('tr'); var edit_main_tr4 = document.createElement('tr'); edit_main_tr4.style.cssText = "display:none;"; var edit_main_tr5 = document.createElement('tr'); var edit_main_tr6 = document.createElement('tr'); var edit_main_tr7 = document.createElement('tr'); var edit_main_tr8 = document.createElement('tr'); var edit_main_tr9 = document.createElement('tr'); var edit_main_td1 = document.createElement('td'); var edit_main_td1_1 = document.createElement('td'); var edit_main_td2 = document.createElement('td'); var edit_main_td2_1 = document.createElement('td'); var edit_main_td3 = document.createElement('td'); var edit_main_td3_1 = document.createElement('td'); var edit_main_td4 = document.createElement('td'); var edit_main_td4_1 = document.createElement('td'); var edit_main_td5 = document.createElement('td'); var edit_main_td5_1 = document.createElement('td'); var edit_main_td6 = document.createElement('td'); var edit_main_td6_1 = document.createElement('td'); var edit_main_td7 = document.createElement('td'); var edit_main_td7_1 = document.createElement('td'); var edit_main_td8 = document.createElement('td'); var edit_main_td8_1 = document.createElement('td'); var edit_main_td9 = document.createElement('td'); var edit_main_td9_1 = document.createElement('td'); var el_label_label = document.createElement('label'); el_label_label.setAttribute("for", "edit_for_label"); el_label_label.setAttribute("class", "fm-field-label"); el_label_label.innerHTML = "Field label"; var el_label_textarea = document.createElement('textarea'); el_label_textarea.setAttribute("id", "edit_for_label"); el_label_textarea.setAttribute("rows", "4"); el_label_textarea.setAttribute("onKeyUp", "change_label('"+i+"_element_labelform_id_temp', this.value)"); el_label_textarea.innerHTML = w_field_label; var el_label_size_label = document.createElement('label'); el_label_size_label.setAttribute("class", "fm-field-label"); el_label_size_label.setAttribute("for", "edit_for_label_size"); el_label_size_label.innerHTML = "Field label size(px) "; var el_label_size = document.createElement('input'); el_label_size.setAttribute("id", "edit_for_label_size"); el_label_size.setAttribute("type", "text"); el_label_size.setAttribute("value", w_field_label_size); el_label_size.setAttribute("onKeyPress", "return check_isnum(event)"); el_label_size.setAttribute("onKeyUp", "change_w_style('"+i+"_label_sectionform_id_temp', this.value)"); var el_label_position_label = document.createElement('label'); el_label_position_label.setAttribute("class", "fm-field-label"); el_label_position_label.innerHTML = "Field label position"; var el_label_position1 = document.createElement('input'); el_label_position1.setAttribute("id", "edit_for_label_position_top"); el_label_position1.setAttribute("type", "radio"); el_label_position1.setAttribute("name", "edit_for_label_position"); el_label_position1.setAttribute("onchange", "label_left("+i+")"); var el_label_left = document.createElement('label'); el_label_left.setAttribute("for", "edit_for_label_position_top"); el_label_left.innerHTML = "Left"; var el_label_position2 = document.createElement('input'); el_label_position2.setAttribute("id", "edit_for_label_position_left"); el_label_position2.setAttribute("type", "radio"); el_label_position2.setAttribute("name", "edit_for_label_position"); el_label_position2.setAttribute("onchange", "label_top("+i+")"); var el_label_top = document.createElement('label'); el_label_top.setAttribute("for", "edit_for_label_position_left"); el_label_top.innerHTML = "Top"; if(w_field_label_pos=="top") el_label_position2.setAttribute("checked", "checked"); else el_label_position1.setAttribute("checked", "checked"); var el_format_label = document.createElement('label'); el_format_label.setAttribute("class", "fm-field-label"); el_format_label.setAttribute("for", "date_format"); el_format_label.innerHTML = "Date format"; var el_format_textarea = document.createElement('input'); el_format_textarea.setAttribute("id", "date_format"); el_format_textarea.setAttribute("type", "text"); el_format_textarea.setAttribute("value", w_format); el_format_textarea.setAttribute("onChange", "change_date_format(this.value,'"+i+"', 'format')"); var el_button_value_label = document.createElement('label'); el_button_value_label.setAttribute("class", "fm-field-label"); el_button_value_label.setAttribute("for", "button_value"); el_button_value_label.innerHTML = "Date Picker label"; var el_button_value_textarea = document.createElement('input'); el_button_value_textarea.setAttribute("id", "button_value"); el_button_value_textarea.setAttribute("type", "text"); el_button_value_textarea.setAttribute("value", w_but_val); el_button_value_textarea.style.cssText = "width:150px;"; el_button_value_textarea.setAttribute("onKeyUp", "change_file_value(this.value,'"+i+"_buttonform_id_temp')"); var el_disable_past_days_label = document.createElement('label'); el_disable_past_days_label.setAttribute("class", "fm-field-label"); el_disable_past_days_label.setAttribute("for", "el_disable_past_days"); el_disable_past_days_label.innerHTML = "Allow selecting dates starting from current day"; var el_disable_past_days = document.createElement('input'); el_disable_past_days.setAttribute("id", "el_disable_past_days"); el_disable_past_days.setAttribute("type", "checkbox"); el_disable_past_days.setAttribute("onclick", "change_date_format(this.checked, '"+i+"', 'dis_days')"); if(w_disable_past_days == "yes") el_disable_past_days.setAttribute("checked", "checked"); var el_style_label = document.createElement('label'); el_style_label.setAttribute("class", "fm-field-label"); el_style_label.setAttribute("for", "el_style_textarea"); el_style_label.innerHTML = "Class name"; var el_style_textarea = document.createElement('input'); el_style_textarea.setAttribute("id", "el_style_textarea"); el_style_textarea.setAttribute("type", "text"); el_style_textarea.setAttribute("value", w_class); el_style_textarea.setAttribute("onChange", "change_class(this.value,'"+i+"')"); var el_required_label = document.createElement('label'); el_required_label.setAttribute("class", "fm-field-label"); el_required_label.setAttribute("for", "el_required"); el_required_label.innerHTML = "Required"; var el_required = document.createElement('input'); el_required.setAttribute("id", "el_required"); el_required.setAttribute("type", "checkbox"); el_required.setAttribute("onclick", "set_required('"+i+"_required')"); if(w_required == "yes") el_required.setAttribute("checked", "checked"); var el_attr_label = document.createElement('label'); el_attr_label.setAttribute("class", "fm-field-label"); el_attr_label.innerHTML = "Additional Attributes"; var el_attr_add = document.createElement('img'); el_attr_add.setAttribute("src", plugin_url + '/images/add.png?ver=1.8.0'); el_attr_add.style.cssText = 'cursor:pointer; margin-left:68px'; el_attr_add.setAttribute("title", 'add'); el_attr_add.setAttribute("onClick", "add_attr("+i+", 'type_date')"); var el_attr_table = document.createElement('table'); el_attr_table.setAttribute("id", 'attributes'); el_attr_table.setAttribute("border", '0'); el_attr_table.style.cssText = 'margin-left:0px'; var el_attr_tr_label = document.createElement('tr'); el_attr_tr_label.setAttribute("idi", '0'); var el_attr_td_name_label = document.createElement('th'); el_attr_td_name_label.style.cssText = 'width:100px'; var el_attr_td_value_label = document.createElement('th'); el_attr_td_value_label.style.cssText = 'width:100px'; var el_attr_td_X_label = document.createElement('th'); el_attr_td_X_label.style.cssText = 'width:10px'; var el_attr_name_label = document.createElement('label'); el_attr_name_label.style.cssText ="color:#000; font-weight:bold; font-size: 11px"; el_attr_name_label.innerHTML = "Name"; var el_attr_value_label = document.createElement('label'); el_attr_value_label.style.cssText ="color:#000; font-weight:bold; font-size: 11px"; el_attr_value_label.innerHTML = "Value"; el_attr_table.appendChild(el_attr_tr_label); el_attr_tr_label.appendChild(el_attr_td_name_label); el_attr_tr_label.appendChild(el_attr_td_value_label); el_attr_tr_label.appendChild(el_attr_td_X_label); el_attr_td_name_label.appendChild(el_attr_name_label); el_attr_td_value_label.appendChild(el_attr_value_label); n=w_attr_name.length; for(j=1; j<=n; j++) { var el_attr_tr = document.createElement('tr'); el_attr_tr.setAttribute("id", "attr_row_"+j); el_attr_tr.setAttribute("idi", j); var el_attr_td_name = document.createElement('td'); el_attr_td_name.style.cssText = 'width:100px'; var el_attr_td_value = document.createElement('td'); el_attr_td_value.style.cssText = 'width:100px'; var el_attr_td_X = document.createElement('td'); var el_attr_name = document.createElement('input'); el_attr_name.setAttribute("type", "text"); el_attr_name.setAttribute("class", "fm-field-choice"); el_attr_name.setAttribute("value", w_attr_name[j-1]); el_attr_name.setAttribute("id", "attr_name"+j); el_attr_name.setAttribute("onChange", "change_attribute_name("+i+", this, 'type_date')"); var el_attr_value = document.createElement('input'); el_attr_value.setAttribute("type", "text"); el_attr_value.setAttribute("class", "fm-field-choice"); el_attr_value.setAttribute("value", w_attr_value[j-1]); el_attr_value.setAttribute("id", "attr_value"+j); el_attr_value.setAttribute("onChange", "change_attribute_value("+i+", "+j+", 'type_date')"); var el_attr_remove = document.createElement('img'); el_attr_remove.setAttribute("id", "el_choices"+j+"_remove"); el_attr_remove.setAttribute("src", plugin_url + '/images/delete.png?ver=1.8.0'); el_attr_remove.style.cssText = 'cursor:pointer; vertical-align:middle; margin:2px'; el_attr_remove.setAttribute("onClick", "remove_attr("+j+", "+i+", 'type_date')"); el_attr_table.appendChild(el_attr_tr); el_attr_tr.appendChild(el_attr_td_name); el_attr_tr.appendChild(el_attr_td_value); el_attr_tr.appendChild(el_attr_td_X); el_attr_td_name.appendChild(el_attr_name); el_attr_td_value.appendChild(el_attr_value); el_attr_td_X.appendChild(el_attr_remove); } var t = document.getElementById('edit_table'); var br = document.createElement('br'); var br1 = document.createElement('br'); edit_main_td1.appendChild(el_label_label); edit_main_td1_1.appendChild(el_label_textarea); edit_main_td8.appendChild(el_label_size_label); edit_main_td8_1.appendChild(el_label_size); edit_main_td2.appendChild(el_label_position_label); edit_main_td2_1.appendChild(el_label_position1); edit_main_td2_1.appendChild(el_label_left); edit_main_td2_1.appendChild(br); edit_main_td2_1.appendChild(el_label_position2); edit_main_td2_1.appendChild(el_label_top); edit_main_td3.appendChild(el_format_label); edit_main_td3_1.appendChild(el_format_textarea); edit_main_td4.appendChild(el_button_value_label); edit_main_td4_1.appendChild(el_button_value_textarea); edit_main_td9.appendChild(el_disable_past_days_label); edit_main_td9_1.appendChild(el_disable_past_days); edit_main_td5.appendChild(el_style_label); edit_main_td5_1.appendChild(el_style_textarea); edit_main_td6.appendChild(el_required_label); edit_main_td6_1.appendChild(el_required); edit_main_td7.appendChild(el_attr_label); edit_main_td7.appendChild(el_attr_add); edit_main_td7.appendChild(br1); edit_main_td7.appendChild(el_attr_table); edit_main_td7.setAttribute("colspan", "2"); edit_main_tr1.appendChild(edit_main_td1); edit_main_tr1.appendChild(edit_main_td1_1); edit_main_tr8.appendChild(edit_main_td8); edit_main_tr8.appendChild(edit_main_td8_1); edit_main_tr2.appendChild(edit_main_td2); edit_main_tr2.appendChild(edit_main_td2_1); edit_main_tr3.appendChild(edit_main_td3); edit_main_tr3.appendChild(edit_main_td3_1); edit_main_tr4.appendChild(edit_main_td4); edit_main_tr4.appendChild(edit_main_td4_1); edit_main_tr9.appendChild(edit_main_td9); edit_main_tr9.appendChild(edit_main_td9_1); edit_main_tr5.appendChild(edit_main_td5); edit_main_tr5.appendChild(edit_main_td5_1); edit_main_tr6.appendChild(edit_main_td6); edit_main_tr6.appendChild(edit_main_td6_1); edit_main_tr7.appendChild(edit_main_td7); edit_main_tr7.appendChild(edit_main_td7_1); edit_main_table.appendChild(edit_main_tr1); edit_main_table.appendChild(edit_main_tr8); edit_main_table.appendChild(edit_main_tr2); edit_main_table.appendChild(edit_main_tr3); edit_main_table.appendChild(edit_main_tr4); edit_main_table.appendChild(edit_main_tr9); edit_main_table.appendChild(edit_main_tr5); edit_main_table.appendChild(edit_main_tr6); edit_main_table.appendChild(edit_main_tr7); edit_div.appendChild(edit_main_table); t.appendChild(edit_div); add_id_and_name(i, 'type_text'); var adding_type = document.createElement("input"); adding_type.setAttribute("type", "hidden"); adding_type.setAttribute("value", "type_date"); adding_type.setAttribute("name", i+"_typeform_id_temp"); adding_type.setAttribute("id", i+"_typeform_id_temp"); var adding_required = document.createElement("input"); adding_required.setAttribute("type", "hidden"); adding_required.setAttribute("value", w_required); adding_required.setAttribute("name", i+"_requiredform_id_temp"); adding_required.setAttribute("id", i+"_requiredform_id_temp"); var adding_dis_past_days = document.createElement('input'); adding_dis_past_days.setAttribute("type", 'hidden'); adding_dis_past_days.setAttribute("value", w_disable_past_days); adding_dis_past_days.setAttribute("id", i+"_dis_past_daysform_id_temp"); adding_dis_past_days.setAttribute("name", i+"_dis_past_daysform_id_temp"); var div = document.createElement('div'); div.setAttribute("id", "main_div"); var div_field = document.createElement('div'); div_field.setAttribute("id", i+"_elemet_tableform_id_temp"); var div_label = document.createElement('div'); div_label.setAttribute("align", 'left'); div_label.style.display="table-cell"; div_label.style.width=w_field_label_size+"px"; div_label.setAttribute("id", i+"_label_sectionform_id_temp"); var div_element = document.createElement('div'); div_element.setAttribute("align", 'left'); div_element.style.display="table-cell"; div_element.setAttribute("id", i+"_element_sectionform_id_temp"); var table_date = document.createElement('div'); table_date.setAttribute("id", i+"_table_date"); table_date.style.display="table"; var tr_date1 = document.createElement('div'); tr_date1.setAttribute("id", i+"_tr_date1"); tr_date1.style.display="table-row"; var tr_date2 = document.createElement('div'); tr_date2.setAttribute("id", i+"_tr_date2"); tr_date2.style.display="table-row"; var td_date_input1 = document.createElement('div'); td_date_input1.setAttribute("id", i+"_td_date_input1"); td_date_input1.style.display="table-cell"; var td_date_input2 = document.createElement('div'); td_date_input2.setAttribute("id", i+"_td_date_input2"); td_date_input2.style.display="table-cell"; var td_date_input3 = document.createElement('div'); td_date_input3.setAttribute("id", i+"_td_date_input3"); td_date_input3.style.display="table-cell"; var td_date_label1 = document.createElement('div'); td_date_label1.setAttribute("id", i+"_td_date_label1"); td_date_label1.style.display="table-cell"; var td_date_label2 = document.createElement('div'); td_date_label2.setAttribute("id", i+"_td_date_label2"); td_date_label2.style.display="table-cell"; var td_date_label3 = document.createElement('div'); td_date_label3.setAttribute("id", i+"_td_date_label3"); td_date_label3.style.display="table-cell"; var br3 = document.createElement('br'); var br4 = document.createElement('br'); var label = document.createElement('span'); label.setAttribute("id", i+"_element_labelform_id_temp"); label.innerHTML = w_field_label; label.setAttribute("class", "label"); label.style.verticalAlign="top"; var required = document.createElement('span'); required.setAttribute("id", i+"_required_elementform_id_temp"); required.innerHTML = ""; required.setAttribute("class", "required"); required.style.verticalAlign="top"; if(w_required=="yes") required.innerHTML = " *"; var adding = document.createElement('input'); adding.setAttribute("type", 'text'); adding.setAttribute("value", w_date); adding.setAttribute("class", 'wdform-date'); adding.setAttribute("id", i+"_elementform_id_temp"); adding.setAttribute("name", i+"_elementform_id_temp"); adding.setAttribute("maxlength", "10"); adding.setAttribute("size", "10"); var dis_past_days = w_disable_past_days == 'yes' ? true : false; var adding_button = document.createElement('input'); adding_button.setAttribute("id", i+"_buttonform_id_temp"); adding_button.setAttribute("class", "button"); adding_button.setAttribute("type", 'reset'); adding_button.setAttribute("value", w_but_val); adding_button.setAttribute("format", w_format); var main_td = document.getElementById('show_table'); div_label.appendChild(label); div_label.appendChild(required); div_element.appendChild(adding_type); div_element.appendChild(adding_required); div_element.appendChild(adding_dis_past_days); div_element.appendChild(adding); div_element.appendChild(adding_button); div_field.appendChild(div_label); div_field.appendChild(div_element); div.appendChild(div_field); div.appendChild(br3); main_td.appendChild(div); if(w_field_label_pos=="top") label_top(i); change_class(w_class, i); refresh_attr(i, 'type_date'); } function form_maker_getElementsByAttribute(node,tag,attr,value){ var elems = (tag=="*" && node.all) ? node.all : node.getElementsByTagName(tag), returnElems = new Array(), nValue = (typeof value!="undefined") ? new RegExp("(^|\\s)" + value + "(\\s|$)") : null, nAttr, cur; for (var i = 0; i < elems.length; i++) { cur = elems[i]; nAttr = cur.getAttribute && cur.getAttribute(attr); if (typeof nAttr == "string" && nAttr.length > 0) { if (typeof value == "undefined" || (nValue && nValue.test(nAttr))) { returnElems.push(cur); } } } return returnElems; } function change_element_attribute(value, id, type){ if(type == 'w_readonly' || type == 'w_hide_field'){ if(document.getElementById(id+'_elementform_id_temp').getAttribute(type) == 'yes') document.getElementById(id+'_elementform_id_temp').setAttribute(type, 'no'); else document.getElementById(id+'_elementform_id_temp').setAttribute(type, 'yes'); } else { document.getElementById(id+'_elementform_id_temp').setAttribute(type, value); } } function change_input_style(id){ if(!document.getElementById(id+'_elementform_id_temp').getAttribute('readonly')) document.getElementById(id+'_elementform_id_temp').setAttribute('readonly', 'readonly'); else document.getElementById(id+'_elementform_id_temp').removeAttribute('readonly'); } function change_src(b,id,form_id) { for(var j=0;j<=b;j++) document.getElementById(id+'_star_'+j).src=plugin_url + "/images/star_"+document.getElementById(id+'_star_colorform_id_temp').value+".png"; } function reset_src(b,id) { for(var j=0;j<=b;j++) document.getElementById(id+'_star_'+j).src=plugin_url + "/images/star.png"; } function select_star_rating(id,a,form_id){} function change_range_width(a,id,form_id) { document.getElementById( id+"_elementform_id_temp0" ).style.cssText="width:"+a+"px"; document.getElementById( id+"_elementform_id_temp1" ).style.cssText="width:"+a+"px"; document.getElementById( id+"_range_widthform_id_temp" ).value=a; } ////////////////////////////////////////////// /////////// type_page_break ////////////////// /////////////////////////////////////////////// function go_to_type_paypal_price(new_id) { w_attr_name=[]; w_attr_value=[]; w_first_val=['','']; w_title=['','']; w_mini_labels=['Dollars','Cents']; type_paypal_price(new_id,'Amount', '100', 'left', w_first_val, w_title, w_mini_labels, '100', 'no', 'no', '',w_attr_name, w_attr_value, '', '') } function go_to_type_number(new_id) { w_attr_name=[]; w_attr_value=[]; type_number(new_id,'Number:', '100', 'left', '200', '', '', 'no', 'no', '',w_attr_name, w_attr_value); } function go_to_type_wdeditor(new_id) { w_attr_name=[]; w_attr_value=[]; type_wdeditor(new_id,'Editor:', '100', 'left', '380', '200', '', 'no', '',w_attr_name, w_attr_value) } function go_to_type_date(new_id) { w_attr_name=[]; w_attr_value=[]; type_date(new_id, 'Date:', '100', 'left', '', 'no', '', '%Y-%m-%d', '...',w_attr_name, w_attr_value, 'no'); } /////////////////////////////////////////////// /////////// el_page_break ////////////////// /////////////////////////////////////////////// function remove_section_break(id) { var wdform_section_break = jQuery("#wdform_field" + id).parent(); var move = wdform_section_break.next(); var to = wdform_section_break.prev(); move.find('.wdform_column').each(function(col_index, column) { var to_col = to.children().eq(col_index); if (!to_col || to_col.hasClass('wdform_column_empty')) { to.find('.wdform_column_empty').before(column); } else { jQuery(column).find('.wdform_row').each(function(row_index, row) { to_col.append(row); }); } }); wdform_section_break.remove(); move.remove(); } function fm_remove_section(remove_childs) { var section = jQuery('.fm-row-deleting').first().closest('.wdform_section'); var wdform_section_break = section.prev('.wdform_tr_section_break'); if (!remove_childs) { var to = section.prevAll('.wdform_section:first'); if (!to.length) { to = section.nextAll('.wdform_section:first'); } if (!to.length) { return; } section.find('.wdform_column').each(function(col_index, column) { to.append(column); }); } wdform_section_break.remove(); section.remove(); } function remove_row(id) { var wdform_row=document.getElementById( "wdform_field"+id).parentNode; var wdform_column=wdform_row.parentNode; wdform_column.removeChild(wdform_row); } function destroyChildren(node) { while (node.firstChild) node.removeChild(node.firstChild); } function show_or_hide(id) { if (!jQuery("#form_id_tempform_view"+id).is(":visible")) { show_form_view(id); } else { hide_form_view(id); } } function show_form_view(id) { jQuery("#form_id_tempform_view"+id).show(); } function hide_form_view(id) { jQuery("#form_id_tempform_view"+id).hide(); } function generate_buttons(id) { form_view_elemet = document.getElementById("form_id_tempform_view" + id); var td = document.createElement("div"); td.setAttribute("valign", "middle"); td.setAttribute("align", "left"); td.style.display = "inline-block"; td.style.width = "40%"; page_nav.appendChild(td); if (form_view_elemet.parentNode.previousSibling) { if (form_view_elemet.parentNode.previousSibling.tagName == "DIV") { table = true; } else if (form_view_elemet.parentNode.previousSibling.previousSibling) { if (form_view_elemet.parentNode.previousSibling.previousSibling.tagName == "DIV") { table = true; } else { table = false; } } else { table = false; } if (table) { if (form_view_elemet.getAttribute('previous_title')) { previous_title = form_view_elemet.getAttribute('previous_title'); previous_type = form_view_elemet.getAttribute('previous_type'); previous_class = form_view_elemet.getAttribute('previous_class'); } else { previous_title = "Previous"; previous_type = "button"; previous_class = ""; } next_or_previous = "previous"; previous = make_pagebreak_button(next_or_previous, previous_title, previous_type, previous_class, id); td.appendChild(previous); } } var td = document.createElement("div"); td.setAttribute("id", "page_numbersform_id_temp" + id); td.setAttribute("valign", "middle"); td.setAttribute("align", "center"); td.style.display = "inline-block"; td.style.width = "20%"; page_nav.appendChild(td); var td = document.createElement("div"); td.setAttribute("valign", "middle"); td.setAttribute("align", "right"); td.style.display = "inline-block"; td.style.width = "40%"; page_nav.appendChild(td); if (form_view_elemet.parentNode.nextSibling) { if (form_view_elemet.parentNode.nextSibling.tagName == "DIV") { table = true; } else if (form_view_elemet.parentNode.nextSibling.nextSibling) { if (form_view_elemet.parentNode.nextSibling.nextSibling.tagName == "DIV") { table = true; } else { table = false; } } else { table = false; } if (table) { if (form_view_elemet.getAttribute('previous_title')) { next_title = form_view_elemet.getAttribute('next_title'); next_type = form_view_elemet.getAttribute('next_type'); next_class = form_view_elemet.getAttribute('next_class'); } else { next_title = "Next"; next_type = "button"; next_class = ""; } next_or_previous = "next"; next = make_pagebreak_button(next_or_previous, next_title, next_type, next_class, id); td.appendChild(next); } } } function generate_page_nav(id) { form_view = id; document.getElementById('form_id_tempform_view' + id).parentNode.style.borderWidth = "1px"; jQuery('.wdform-page-and-images').each(function(){ var index = jQuery(this).find('.form_id_tempform_view_img').attr('id').split("form_id_tempform_view_img"); t = index[1]; page_nav = document.getElementById("form_id_temppage_nav" + t); destroyChildren(page_nav); generate_buttons(t); }); generate_page_bar(); refresh_page_numbers(); } function remove_page(id) { jQuery('#fm_delete_page_id').val(id); fm_popup_toggle('fm_delete_page_popup_container'); } function remove_field(id, e) { jQuery('#fm_delete_field_id').val(id); fm_popup_toggle('fm_delete_field_popup_container'); if ( typeof e != "undefined" ) { e.stopPropagation(); e.preventDefault(); } } function fm_remove_column_popup(that) { jQuery('.wdform_column').removeClass('fm-column-deleting'); jQuery(that).closest('.wdform_column').addClass('fm-column-deleting'); fm_popup_toggle('fm_delete_column_popup_container'); } function fm_remove_row_popup(that) { jQuery('.wdform_section').removeClass('fm-row-deleting'); jQuery(that).closest('.wdform_section').addClass('fm-row-deleting'); fm_popup_toggle('fm_delete_row_popup_container'); } function fm_remove_column() { jQuery('.fm-column-deleting').remove(); } function remove_page_only() { id = jQuery('#fm_delete_page_id').val(); refresh_pages_without_deleting(id); } function remove_page_all() { id = jQuery('#fm_delete_page_id').val(); form_view_elemet = document.getElementById("form_id_tempform_view" + id); form_view_count = 0; var form_view_count = jQuery(".wdform-page-and-images").length; if (form_view_count == 2) { jQuery(".form_id_tempform_view_img").removeClass('form_view_show').addClass('form_view_hide'); jQuery('*[id*=form_id_temppage_nav]').empty(); } if (form_view_count == 1) { form_view_elemet.innerHTML = ''; tbody = form_view_elemet; tr = document.createElement('div'); tr.setAttribute('class', 'wdform_section'); tr.style.display = "table-row"; tr_page_nav = document.createElement('div'); tr_page_nav.setAttribute('valign', 'top'); tr_page_nav.setAttribute('class', 'wdform_footer'); tr_page_nav.style.width = "100%"; td_page_nav = document.createElement('div'); td_page_nav.style.width = "100%"; table_min_page_nav = document.createElement('div'); table_min_page_nav.style.width = "100%"; table_min_page_nav.style.display = "table"; tbody_min_page_nav = document.createElement('div'); tbody_min_page_nav.style.display = "table-row-group"; tr_min_page_nav = document.createElement('div'); tr_min_page_nav.setAttribute('id', 'form_id_temppage_nav' + form_view); tr_min_page_nav.style.display = "table-row"; table_min = document.createElement('div'); table_min.setAttribute('class', 'wdform_column'); tr.appendChild(table_min); tbody_min_page_nav.appendChild(tr_min_page_nav); table_min_page_nav.appendChild(tbody_min_page_nav); td_page_nav.appendChild(table_min_page_nav); tr_page_nav.appendChild(td_page_nav); tbody.appendChild(tr); tbody.appendChild(tr_page_nav); return; } form_view_table = form_view_elemet.parentNode; document.getElementById("take").removeChild(form_view_table); refresh_pages(id); } function refresh_pages(id) { temp = 1; form_view_count = 0; destroyChildren(document.getElementById("pages")); var form_view_count = jQuery(".wdform-page-and-images").length; generate_page_bar(); if (form_view_count > 1) { jQuery('#page_bar').removeClass('form_view_hide'); } else { destroyChildren(document.getElementById("edit_page_navigation")); jQuery('#page_bar').addClass('form_view_hide'); jQuery(".wdform_page").removeAttr('style'); } } function refresh_pages_without_deleting(id) { var form_view_elemet = jQuery("#form_id_tempform_view" + id); var wdform_row = form_view_elemet.find('.wdform_row'); var form_view_count = jQuery(".wdform-page-and-images").length; if (form_view_count == 2) { jQuery(".form_id_tempform_view_img").removeClass('form_view_show').addClass('form_view_hide'); jQuery('*[id*=form_id_temppage_nav]').empty(); } var table = form_view_elemet.parent(); var to = table.prevAll('.wdform-page-and-images:first'); if (!to.length) { to = table.nextAll('.wdform-page-and-images:first'); } if (!to.length) { return; } table.find('.wdform_section').each(function (col_index, column) { var to_col = to.find('.wdform_section').eq(col_index); if (!to_col.length) { to.find('.wdform_row_empty').before(column); } else { jQuery(column).find('.wdform_column:not(:empty)').each(function (row_index, row) { to_col.append(row); }); } }); table.remove(); refresh_pages(id); all_sortable_events(); } function make_page_steps_front() { destroyChildren(document.getElementById("pages")); show_title = document.getElementById('el_show_title_input').checked; k = 0; jQuery('.wdform-page-and-images').each(function () { var index = jQuery(this).find('.wdform_page').attr('id'); j = index.split("form_id_tempform_view")[1]; if (document.getElementById('form_id_tempform_view' + j).getAttribute('page_title')) { w_pages = document.getElementById('form_id_tempform_view' + j).getAttribute('page_title'); } else { w_pages = ""; } k++; page_number = document.createElement('span'); page_number.setAttribute('id', 'page_' + j); page_number.setAttribute('onClick', 'generate_page_nav("' + j + '")'); if (j == form_view) { page_number.setAttribute('class', "page_active"); } else { page_number.setAttribute('class', "page_deactive"); } if (show_title) { page_number.innerHTML = w_pages; } else { page_number.innerHTML = k; } document.getElementById("pages").appendChild(page_number); }); } function make_page_percentage_front() { destroyChildren(document.getElementById("pages")); show_title = document.getElementById('el_show_title_input').checked; var div_parent = document.createElement('div'); div_parent.setAttribute("class", "page_percentage_deactive"); var div = document.createElement('div'); div.setAttribute("id", "div_percentage"); div.setAttribute("class", "page_percentage_active"); var b = document.createElement('b'); div.appendChild(b); k = 0; cur_page_title = ''; jQuery('.wdform-page-and-images').each(function () { var index = jQuery(this).find('.wdform_page').attr('id'); j = index.split("form_id_tempform_view")[1]; if (document.getElementById('form_id_tempform_view' + j).getAttribute('page_title')) { w_pages = document.getElementById('form_id_tempform_view' + j).getAttribute('page_title'); } else { w_pages = ""; } k++; if (j == form_view) { if (show_title) { var cur_page_title = document.createElement('span'); if (k == 1) { cur_page_title.style.paddingLeft = "30px"; } else { cur_page_title.style.paddingLeft = "5px"; } cur_page_title.innerHTML = w_pages; } page_number = k; } }); b.innerHTML = Math.round(((page_number - 1) / k) * 100) + '%'; div.style.width = ((page_number - 1) / k) * 100 + '%'; div_parent.appendChild(div); if (cur_page_title) { div_parent.appendChild(cur_page_title); } document.getElementById("pages").appendChild(div_parent); } function make_page_none_front() { var no_pagbar = document.createElement('div'); no_pagbar.innerHTML = "NO PAGE BAR"; jQuery('#pages').empty(); jQuery('#pages').append(no_pagbar); } function generate_page_bar() { need_enable = false; el_page_navigation(); add(0, false); need_enable = true; } function remove_add_(id) { attr_name= new Array(); attr_value= new Array(); var input = document.getElementById(id); atr=input.attributes; for(v=0;v<30;v++) if(atr[v] ) { if(atr[v].name.indexOf("add_")==0) { attr_name.push(atr[v].name.replace('add_','')); attr_value.push(atr[v].value); input.removeAttribute(atr[v].name); v--; } } for(v=0;v"); //document.getElementById('pos_end').checked = true; type=document.getElementById("wdform_field"+id).getAttribute('type'); //////////////////////////////parameter take if(document.getElementById(id+'_element_labelform_id_temp').innerHTML) w_field_label=document.getElementById(id+'_element_labelform_id_temp').innerHTML; labels=all_labels(); m=0; t=true; if(type!="type_section_break") { while(t) { m++; for(k=0; k