Link to home
Start Free TrialLog in
Avatar of Bade011
Bade011

asked on

How to validate south korean personal custom clearance code (PCCC) using javascript/jquery?

Hi Experts,
I tried every means to figure out the validation for south Korean "Personal Custom Clearance Code" (PCCC). I didn't find enough resources about it other than some blog and articles about requirement of pcc code as mandatory for importing. PCCC is the code that is used for clearing the custom if someone is buying stuffs/products internationally. It is like ssn in the USA having 13 digits in total starting with letter "P". For example: P123451234512. I am not sure if I could ask this kind of question here but if someone knows about it, that would be nice.  All I did till now is I validated a text box for PCCC by length=13 under html. Is there anyone who know how to validate the PCC code using javascript?

<fieldset>
      <legend>Validate korean PCCC</legend>
      <div style= "padding-top:15px;">
            <label style= "padding: 20px; font-size: 16px; font-weight:600; color: #AA6903;">Personal Custom Clearance Code: </label>
            <input type="text" id="inputcpf" name="pccc" size="13" maxlength="13" autofocus>
            <input type="button" style= "margin-top:10px;" class="btnchec" name="Submit" value="Check">
      </div>
</fieldset>

Thank you
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

Well, use a regex.

<body>
<script>
function checkPCCC(psPCCC)
{
    if(psPCCC.match(/^[A-Za-z][0-9]+$/))
       alert('match');
    else
        alert('no match');
}
    </script>
    <fieldset>
      <legend>Validate korean PCCC</legend>
      <div style= "padding-top:15px;">
            <label style= "padding: 20px; font-size: 16px; font-weight:600; color: #AA6903;">Personal Custom Clearance Code: </label>
            <input type="text" id="inputcpf" name="pccc" size="13" maxlength="13" autofocus>
            <input type="button" style= "margin-top:10px;" class="btnchec" name="Submit" value="Check" onclick=checkPCCC(document.getElementById("inputcpf").value)>
      </div>
</fieldset>
          </body>

Open in new window


See it working here: https://jsfiddle.net/x0rqn5xL/
If you want case sensitive, then put:

if(psPCCC.match(/^[A-Z][0-9]+$/))

According to here: http://awarekorea.com/knowledge-base/personal-customs-clearance-code/

It says the format is "The Personal Customs Clearance Code is typically formed by one letter and 12 digits. Example: P123456789012"

It doesn't specifically state it is a P followed by 12 numbers. If it is always a P, then you could just ask that the user enter just the numberic part of the PCCC and limit the input to 12 digits and make the regex this:

if(psPCCC.match(/^[0-9]+$/))
Avatar of Bade011
Bade011

ASKER

So ya since there is no format for this code (atleast I couldn't find since 2 days of research), I was thinking, can any number be acceptable for PCCC or there is some kind of secret governmental algorithm or logic for it. for eg: when I tried P123451234512 in some kind of website, it says its incorrect. so i was wondering how and what kind of validation that website used?
https://secure.iherb.com/transactions/checkout one has to create account to check this url.
From what I read, the PCCC isn't required as you can use your passport number instead, but it replaces 2 other codes which I can't recall the name of now, other than one had the word "alien" in it.

As this change seems to have happened in January 2015, it doesn't look like it's been widely taken up, so you may need to question whether it's worth spending the time developing something for little or no return.

Obviously I don't know your need for this other than what you said in the quetion. I couldn't see any format for the code either.
Avatar of Bade011

ASKER

Actually, PCC code is mandatory for the citizens and for foreigners (living their temporarily) passport number and alien registration numbers are asked. Talking about my need for this project, our Korean customers aren't getting their orders on the time due to lack of their PCC code during custom clearing. Therefore, I have been trying to add PCC validation code and planning to ask our Korean customers' PCC code. But as I mentioned earlier,I couldn't find any help on the internet. It might be because its just implemented as you mentioned. Thank you Mr Lee Savidge for your help. I really appreciate it.
ASKER CERTIFIED SOLUTION
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial