영카트 셀렉트 값 DB 입력 관련 부분입니다.

영카트 셀렉트 값 DB 입력 관련 부분입니다.

QA

영카트 셀렉트 값 DB 입력 관련 부분입니다.

본문

안녕하세요. 늘 도움 받고 있습니다. 감사합니다. 

제가 국가 드랍다운 박스를 만들어서 안에 국가명과 국기 아이콘을 넣었는데요. 사용자가 선택을 해도 POST 로 값이 전달 되지도 않고 DB 입력도 되지 않습니다. 어떻게 해야 할까요? 코드 좀 한 번 봐주실 수 있나요?
 

<script src="https://jsuites.net/v4/jsuites.js"></script>

<link rel="stylesheet" href="https://jsuites.net/v4/jsuites.css" type="text/css" />

 

      <div class="addr-line">

       <div id="dropdown" for="overseas_country" disabled></div>

       <input type="hidden" id="overseas_country" name="overseas_country">

      </div>

<script>

var countries = [

    { "text": "Afghanistan", "value": "AF" },

    { "text": "Åland Islands", "value": "AX" },

    { "text": "Albania", "value": "AL" },

    { "text": "Algeria", "value": "DZ" },

    { "text": "American Samoa", "value": "AS" },

    { "text": "Andorra", "value": "AD" },

    { "text": "Angola", "value": "AO" },

    { "text": "Anguilla", "value": "AI" },

    { "text": "Antarctica", "value": "AQ" },

    { "text": "Antigua and Barbuda", "value": "AG" },

    { "text": "Argentina", "value": "AR" },

    { "text": "Armenia", "value": "AM" },

    { "text": "Aruba", "value": "AW" },

    { "text": "Australia", "value": "AU" },

    { "text": "Austria", "value": "AT" },

    { "text": "Azerbaijan", "value": "AZ" },

    { "text": "Bahamas", "value": "BS" },

    { "text": "Bahrain", "value": "BH" },

    { "text": "Bangladesh", "value": "BD" },

    { "text": "Barbados", "value": "BB" },

    { "text": "Belarus", "value": "BY" },

    { "text": "Belgium", "value": "BE" },

    { "text": "Belize", "value": "BZ" },

    { "text": "Benin", "value": "BJ" },

    { "text": "Bermuda", "value": "BM" },

    { "text": "Bhutan", "value": "BT" },

    { "text": "Bolivia", "value": "BO" },

    { "text": "Bosnia and Herzegovina", "value": "BA" },

    { "text": "Botswana", "value": "BW" },

    { "text": "Bouvet Island", "value": "BV" },

    { "text": "Brazil", "value": "BR" },

    { "text": "British Indian Ocean Territory", "value": "IO" },

    { "text": "Brunei Darussalam", "value": "BN" },

    { "text": "Bulgaria", "value": "BG" },

    { "text": "Burkina Faso", "value": "BF" },

    { "text": "Burundi", "value": "BI" },

    { "text": "Cambodia", "value": "KH" },

    { "text": "Cameroon", "value": "CM" },

    { "text": "Canada", "value": "CA" },

    { "text": "Cape Verde", "value": "CV" },

    { "text": "Cayman Islands", "value": "KY" },

    { "text": "Central African Republic", "value": "CF" },

    { "text": "Chad", "value": "TD" },

    { "text": "Chile", "value": "CL" },

    { "text": "China", "value": "CN" },

    { "text": "Christmas Island", "value": "CX" },

    { "text": "Cocos (Keeling) Islands", "value": "CC" },

    { "text": "Colombia", "value": "CO" },

    { "text": "Comoros", "value": "KM" },

    { "text": "Congo", "value": "CG" },

    { "text": "Congo, The Democratic Republic of the", "value": "CD" },

    { "text": "Cook Islands", "value": "CK" },

    { "text": "Costa Rica", "value": "CR" },

    { "text": "Cote D'Ivoire", "value": "CI" },

    { "text": "Croatia", "value": "HR" },

    { "text": "Cuba", "value": "CU" },

    { "text": "Cyprus", "value": "CY" },

    { "text": "Czech Republic", "value": "CZ" },

    { "text": "Denmark", "value": "DK" },

    { "text": "Djibouti", "value": "DJ" },

    { "text": "Dominica", "value": "DM" },

    { "text": "Dominican Republic", "value": "DO" },

    { "text": "Ecuador", "value": "EC" },

    { "text": "Egypt", "value": "EG" },

    { "text": "El Salvador", "value": "SV" },

    { "text": "Equatorial Guinea", "value": "GQ" },

    { "text": "Eritrea", "value": "ER" },

    { "text": "Estonia", "value": "EE" },

    { "text": "Ethiopia", "value": "ET" },

    { "text": "Falkland Islands (Malvinas)", "value": "FK" },

    { "text": "Faroe Islands", "value": "FO" },

    { "text": "Fiji", "value": "FJ" },

    { "text": "Finland", "value": "FI" },

    { "text": "France", "value": "FR" },

    { "text": "French Guiana", "value": "GF" },

    { "text": "French Polynesia", "value": "PF" },

    { "text": "French Southern Territories", "value": "TF" },

    { "text": "Gabon", "value": "GA" },

    { "text": "Gambia", "value": "GM" },

    { "text": "Georgia", "value": "GE" },

    { "text": "Germany", "value": "DE" },

    { "text": "Ghana", "value": "GH" },

    { "text": "Gibraltar", "value": "GI" },

    { "text": "Greece", "value": "GR" },

    { "text": "Greenland", "value": "GL" },

    { "text": "Grenada", "value": "GD" },

    { "text": "Guadeloupe", "value": "GP" },

    { "text": "Guam", "value": "GU" },

    { "text": "Guatemala", "value": "GT" },

    { "text": "Guernsey", "value": "GG" },

    { "text": "Guinea", "value": "GN" },

    { "text": "Guinea-Bissau", "value": "GW" },

    { "text": "Guyana", "value": "GY" },

    { "text": "Haiti", "value": "HT" },

    { "text": "Heard Island and Mcdonald Islands", "value": "HM" },

    { "text": "Holy See (Vatican City State)", "value": "VA" },

    { "text": "Honduras", "value": "HN" },

    { "text": "Hong Kong", "value": "HK" },

    { "text": "Hungary", "value": "HU" },

    { "text": "Iceland", "value": "IS" },

    { "text": "India", "value": "IN" },

    { "text": "Indonesia", "value": "ID" },

    { "text": "Iran, Islamic Republic Of", "value": "IR" },

    { "text": "Iraq", "value": "IQ" },

    { "text": "Ireland", "value": "IE" },

    { "text": "Isle of Man", "value": "IM" },

    { "text": "Israel", "value": "IL" },

    { "text": "Italy", "value": "IT" },

    { "text": "Jamaica", "value": "JM" },

    { "text": "Japan", "value": "JP" },

    { "text": "Jersey", "value": "JE" },

    { "text": "Jordan", "value": "JO" },

    { "text": "Kazakhstan", "value": "KZ" },

    { "text": "Kenya", "value": "KE" },

    { "text": "Kiribati", "value": "KI" },

    { "text": "Korea, Democratic People'S Republic of", "value": "KP" },

    { "text": "Korea, Republic of", "value": "KR" },

    { "text": "Kuwait", "value": "KW" },

    { "text": "Kyrgyzstan", "value": "KG" },

    { "text": "Lao People'S Democratic Republic", "value": "LA" },

    { "text": "Latvia", "value": "LV" },

    { "text": "Lebanon", "value": "LB" },

    { "text": "Lesotho", "value": "LS" },

    { "text": "Liberia", "value": "LR" },

    { "text": "Libyan Arab Jamahiriya", "value": "LY" },

    { "text": "Liechtenstein", "value": "LI" },

    { "text": "Lithuania", "value": "LT" },

    { "text": "Luxembourg", "value": "LU" },

    { "text": "Macao", "value": "MO" },

    { "text": "Macedonia, The Former Yugoslav Republic of", "value": "MK" },

    { "text": "Madagascar", "value": "MG" },

    { "text": "Malawi", "value": "MW" },

    { "text": "Malaysia", "value": "MY" },

    { "text": "Maldives", "value": "MV" },

    { "text": "Mali", "value": "ML" },

    { "text": "Malta", "value": "MT" },

    { "text": "Marshall Islands", "value": "MH" },

    { "text": "Martinique", "value": "MQ" },

    { "text": "Mauritania", "value": "MR" },

    { "text": "Mauritius", "value": "MU" },

    { "text": "Mayotte", "value": "YT" },

    { "text": "Mexico", "value": "MX" },

    { "text": "Micronesia, Federated States of", "value": "FM" },

    { "text": "Moldova, Republic of", "value": "MD" },

    { "text": "Monaco", "value": "MC" },

    { "text": "Mongolia", "value": "MN" },

    { "text": "Montserrat", "value": "MS" },

    { "text": "Morocco", "value": "MA" },

    { "text": "Mozambique", "value": "MZ" },

    { "text": "Myanmar", "value": "MM" },

    { "text": "Namibia", "value": "NA" },

    { "text": "Nauru", "value": "NR" },

    { "text": "Nepal", "value": "NP" },

    { "text": "Netherlands", "value": "NL" },

    { "text": "Netherlands Antilles", "value": "AN" },

    { "text": "New Caledonia", "value": "NC" },

    { "text": "New Zealand", "value": "NZ" },

    { "text": "Nicaragua", "value": "NI" },

    { "text": "Niger", "value": "NE" },

    { "text": "Nigeria", "value": "NG" },

    { "text": "Niue", "value": "NU" },

    { "text": "Norfolk Island", "value": "NF" },

    { "text": "Northern Mariana Islands", "value": "MP" },

    { "text": "Norway", "value": "NO" },

    { "text": "Oman", "value": "OM" },

    { "text": "Pakistan", "value": "PK" },

    { "text": "Palau", "value": "PW" },

    { "text": "Palestinian Territory, Occupied", "value": "PS" },

    { "text": "Panama", "value": "PA" },

    { "text": "Papua New Guinea", "value": "PG" },

    { "text": "Paraguay", "value": "PY" },

    { "text": "Peru", "value": "PE" },

    { "text": "Philippines", "value": "PH" },

    { "text": "Pitcairn", "value": "PN" },

    { "text": "Poland", "value": "PL" },

    { "text": "Portugal", "value": "PT" },

    { "text": "Puerto Rico", "value": "PR" },

    { "text": "Qatar", "value": "QA" },

    { "text": "Reunion", "value": "RE" },

    { "text": "Romania", "value": "RO" },

    { "text": "Russian Federation", "value": "RU" },

    { "text": "RWANDA", "value": "RW" },

    { "text": "Saint Helena", "value": "SH" },

    { "text": "Saint Kitts and Nevis", "value": "KN" },

    { "text": "Saint Lucia", "value": "LC" },

    { "text": "Saint Pierre and Miquelon", "value": "PM" },

    { "text": "Saint Vincent and the Grenadines", "value": "VC" },

    { "text": "Samoa", "value": "WS" },

    { "text": "San Marino", "value": "SM" },

    { "text": "Sao Tome and Principe", "value": "ST" },

    { "text": "Saudi Arabia", "value": "SA" },

    { "text": "Senegal", "value": "SN" },

    { "text": "Serbia and Montenegro", "value": "CS" },

    { "text": "Seychelles", "value": "SC" },

    { "text": "Sierra Leone", "value": "SL" },

    { "text": "Singapore", "value": "SG" },

    { "text": "Slovakia", "value": "SK" },

    { "text": "Slovenia", "value": "SI" },

    { "text": "Solomon Islands", "value": "SB" },

    { "text": "Somalia", "value": "SO" },

    { "text": "South Africa", "value": "ZA" },

    { "text": "South Georgia and the South Sandwich Islands", "value": "GS" },

    { "text": "Spain", "value": "ES" },

    { "text": "Sri Lanka", "value": "LK" },

    { "text": "Sudan", "value": "SD" },

    { "text": "Suriname", "value": "SR" },

    { "text": "Svalbard and Jan Mayen", "value": "SJ" },

    { "text": "Swaziland", "value": "SZ" },

    { "text": "Sweden", "value": "SE" },

    { "text": "Switzerland", "value": "CH" },

    { "text": "Syrian Arab Republic", "value": "SY" },

    { "text": "Taiwan, Province of China", "value": "TW" },

    { "text": "Tajikistan", "value": "TJ" },

    { "text": "Tanzania, United Republic of", "value": "TZ" },

    { "text": "Thailand", "value": "TH" },

    { "text": "Timor-Leste", "value": "TL" },

    { "text": "Togo", "value": "TG" },

    { "text": "Tokelau", "value": "TK" },

    { "text": "Tonga", "value": "TO" },

    { "text": "Trinidad and Tobago", "value": "TT" },

    { "text": "Tunisia", "value": "TN" },

    { "text": "Turkey", "value": "TR" },

    { "text": "Turkmenistan", "value": "TM" },

    { "text": "Turks and Caicos Islands", "value": "TC" },

    { "text": "Tuvalu", "value": "TV" },

    { "text": "Uganda", "value": "UG" },

    { "text": "Ukraine", "value": "UA" },

    { "text": "United Arab Emirates", "value": "AE" },

    { "text": "United Kingdom", "value": "GB" },

    { "text": "United States", "value": "US", synonym: ['USA','United States of America'] },

    { "text": "United States Minor Outlying Islands", "value": "UM" },

    { "text": "Uruguay", "value": "UY" },

    { "text": "Uzbekistan", "value": "UZ" },

    { "text": "Vanuatu", "value": "VU" },

    { "text": "Venezuela", "value": "VE" },

    { "text": "Viet Nam", "value": "VN" },

    { "text": "Virgin Islands, British", "value": "VG" },

    { "text": "Virgin Islands, U.S.", "value": "VI" },

    { "text": "Wallis and Futuna", "value": "WF" },

    { "text": "Western Sahara", "value": "EH" },

    { "text": "Yemen", "value": "YE" },

    { "text": "Zambia", "value": "ZM" },

    { "text": "Zimbabwe", "value": "ZW" }

];

 

for (var i = 0; i < countries.length; i++) {

    countries[i].image = 'https://cdn.jsdelivr.net/npm/svg-country-flags@1.2.10/svg/' + countries[i].value.toLowerCase() + '.svg';

}

 

var dropdown = jSuites.dropdown(document.getElementById('dropdown'), {

        data: countries,

        autocomplete: true,

        multiple: false,

        width: '280px',

    });

 

    dropdown.addEventListener('change', function(event) {

        var selectedCountry = event.target.value;

 

        document.getElementById('overseas_country').value = selectedCountry;

    });

</script>

체크 박스 "해외 배송"을 체크 표시하면 disabled 가 풀리는 구조 입니다. 감사합니다!

이 질문에 댓글 쓰기 :

답변 1

소스상으로는 overseas_country에 값이 들어가야 하는데요.


    dropdown.addEventListener('change', function(event) {
        var selectedCountry = event.target.value;
        alert(selectedCountry);
        document.getElementById('overseas_country').value = selectedCountry;
    });

이렇게 하셔서 값이 들어오는지 체크해보셔야 할듯 합니다.

function setSelectedCountry() {
    var selectedCountry = dropdown.getValue();
    document.getElementById('overseas_country').value = selectedCountry;
  }

  document.getElementById('dropdown').addEventListener('click', setSelectedCountry);

이렇게 해서 값은 받아왔는데 결제 버튼을 클릭하니까

고객님의 주문 정보를 처리하는 중 오류가 발생해서 주문이 완료되지 않았습니다.

KCP를 이용한 전자결제(신용카드, 계좌이체, 가상계좌 등)은 자동 취소되었습니다.

라면서 die 가 되버렸는데 뭐가 문제인지 모르겠네요 .. ;

답변을 작성하시기 전에 로그인 해주세요.
전체 64 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT