Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
<div class="container"> 
    <h1>CV forma</h1>    
    <p> Sva polja su obavezna. </p>
    
        <div id="ds-message" class="animate-bottom">   
            <button id="ds-message-button" type="button" onclick="dsijak.cv.closeMessage()"><b>×</b></button>
            <div id="ds-message-text"> <h1 id="ds-message-title">...</h1>  <span id="ds-message-text-body">...</span> </div> 
        </div>
            
     
       
            <input id="ds-input-ime" type="text" name="text-ime" placeholder="Ime" maxlength="256" required="required">
            <br>
            <input id="ds-input-prezime" type="text" name="text-prezime" placeholder="Prezime" maxlength="256" required="required">
            <br>
            <div style="display:flex;">
                <input id="ds-input-naziv-ulice" type="text" name="text-naziv-ulice" placeholder="Naziv ulice" maxlength="256" required="required">
                <div style="margin-right: 16px;"></div>
                <input id="ds-input-kucanski-broj" type="text" name="text-kucanski-broj" class="auto" placeholder="Kućanski broj" maxlength="11" required="required" >
            </div>
            <br>
            <div style="display:flex;">
                <input id="ds-input-mjesto" type="text" name="text-mjesto"  placeholder="Mjesto" maxlength="256" required="required">
                <div style="margin-right: 16px;"></div>
                <input id="ds-input-postanski-broj" type="text" pattern="\d*" name="number-postanski-broj" class="auto" minlength="5" maxlength="5" placeholder="Poštanski broj" required="required" >
            </div>
            <br>
            <input id="ds-input-broj-mobitela" type="tel" name="tel-mobitel" pattern="[0-9]{3} [0-9]{3} [0-9]{4}" placeholder="Broj mobitela (094 949 9494)" maxlength="12" required="required">
          
            <br>
            <input id="ds-input-email" type="email" name="email-email" placeholder="Email" maxlength="320" required="required">
            
            <br>
            <div style="display:flex;">
                <div class="center"><div class="auto" style="color:gray">Datum rođenja</div></div>
                <div style="margin-right: 16px;"></div>
                <input id="ds-input-datum-rodenja" name="date-datum-rodenja" type="date" value="1900-12-20">
            </div>
  
            <br>
            
            <div class="auto" style="color:gray">Spol</div>
            <br><br>
            <div class="">
                <label class="radio-container">Muški
                  <input id="ds-input-spol-muski" type="radio" checked="checked" name="radio-spol">
                  <span class="checkmark"></span>
                </label>
                <label class="radio-container">Ženski
                  <input id="ds-input-spol-zenski" type="radio" name="radio-spol">
                  <span class="checkmark"></span>
                </label>
            </div>
            
            <br>
        
            <div class="auto" style="color:gray">Imate li vozačku B kategorije?</div>
            <br><br>
            <div class="">
                <label class="radio-container">Da
                  <input id="ds-input-vozacka-da" type="radio" checked="checked" name="radio-vozacka">
                  <span class="checkmark"></span>
                </label>
                <label class="radio-container">Ne
                  <input id="ds-input-vozacka-ne" type="radio" name="radio-vozacka">
                  <span class="checkmark"></span>
                </label>
            </div>
            <br>
   
    
    
         
         <div class="form-group">
             <div style="color:gray"> Vaš životopis </div>
             <br>
            <div style="display:flex;">                                
                <button type="button" onclick="document.getElementById('ds-input-zivotopis-skriveno').click()">Učitaj</button>
                <div style="margin-right: 16px;"></div>
                                
                <input id="ds-input-zivotopis-skriveno" name="file-zivotopis-upload" type="file" accept=".pdf" style="display:none" onchange="document.getElementById('ds-input-zivotopis').value = this.files[0].name;">
                <input id="ds-input-zivotopis" type="text" name="file-zivotopis" placeholder="Priložite datoteku u PDF formatu" maxlength="320" readonly>
            </div>
        </div> 
        <br>
        
        
        <br>
        <div class="">
             <label class="checkbox-container" style="color:gray"> <span id="ds-input-pravila-text">Prihvaćam <a href="#" style="color:red">pravila privatnosti</a>?</span>
              <input id="ds-input-pravila-privatnosti" type="checkbox">
              <span class="checkmark"></span>
            </label>
        </div>
        <br> 
         
        
         

    <button onclick="dsijak.cv.onSubmit(); return false;" >Pošalji</button> 
    
<br>
</div>

              
            
!

CSS

              
                * {font-family: Open Sans; font-size: 18px; font-weight: 400;}
html{box-sizing:border-box}*,:after,:before{box-sizing:inherit}html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section{display:block}summary{display:list-item}audio,canvas,progress,video{display:inline-block}progress{vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}dfn{font-style:italic}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}figure{margin:1em 40px}img{border-style:none}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}hr{box-sizing:content-box;height:0;overflow:visible}button,input,optgroup,select,textarea{font:inherit;margin:0}optgroup{font-weight:700}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto}[type=checkbox],[type=radio]{padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}h1{font-size:36px}h2{font-size:30px}h3{font-size:24px}h4{font-size:20px}h5{font-size:18px}h6{font-size:16px}
input{padding:8px;display:block;border:none;border-bottom:1px solid #ccc;width:100%}
button{color:white;background:red;border-radius:;border:none;display:inline-block;padding:8px 16px;vertical-align:middle;overflow:hidden;text-decoration:none;text-align:center;cursor:pointer;white-space:nowrap}
button:hover{border-radius:;color:#000!important;background-color:#ccc!important}

h1,h2,h3,h3,h5,h6 {font-family: Open Sans; font-weight: 800; color:#666;}

.margin{margin:16px!important}
.padding{padding:8px 16px!important}
.container{padding:16px 16px; margin-top:16px; margin-bottom:16px;}
.absolute{position:absolute}
.relative{position:relative}
.fixed{position:fixed}
.auto{width:auto;height:auto; display:ruby; }
.tab{padding-left: 32px;}
.center{display: flex; justify-content: center; align-items: center;} 
p{ font-weight: 300;}

.checkbox-container {
  display: block;
  position: relative;
  padding-left: 35px;
  margin-bottom: 12px;
  cursor: pointer;
  font-size: 18px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  width: 50%;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}
.checkbox-container .checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 25px;
  width: 25px;
  background-color: #ddd;
}

.checkbox-container:hover input ~ .checkmark {
  background-color: #ccc;
}

.checkbox-container input:checked ~ .checkmark {
  background-color: #FF0000;
}

.checkbox-container .checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-container .checkmark:after {
  left: 10px;
  top: 7px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 3px 3px 0;
  -webkit-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
}

.radio-container {
  color: gray;
  display: block;
  position: relative;
  padding-left: 35px;
  margin-bottom: 12px;
  cursor: pointer;
  font-size: 18px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  width: 30%;
}

.radio-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.radio-container .checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 25px;
  width: 25px;
  background-color: #ddd;
  border-radius: 50%;
}

.radio-container:hover input ~ .checkmark {
  background-color: #ccc;
}

.radio-container input:checked ~ .checkmark {
  background-color: red;
}

.radio-container .checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.radio-container input:checked ~ .checkmark:after {
  display: block;
}

.radio-container .checkmark:after {
 	top: 9px;
	left: 9px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: white;
}

#ds-message{
    color: white;
    background: black;   
    position: fixed;
    bottom: 0px;
    right: 0px;
    margin: 16px;  
    box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
    user-select: none;
    cursor: context-menu;  
    display: none;  
}

#ds-message #ds-message-text{
    padding: 16px;   
}

#ds-message #ds-message-text-body{
    font-size: 14px;  
}

#ds-message h1{
    padding: 0px 120px 0px 0px;   
    margin: 0px 0px 16px 0px;   
    font-size: 18px;  
    color: #fff;
    opacity: .50;
}

#ds-message button{
    position: absolute;
    right: 0px;
    z-index: 9999 !important;
}

.animate-bottom{position:relative;animation:animatebottom 0.4s}@keyframes animatebottom{from{bottom:-300px;opacity:0} to{bottom:0;opacity:1}}
.animate-fading{animation:fading 1.5s infinite}@keyframes fading{0%{opacity:0}50%{opacity:1}100%{opacity:0}}

              
            
!

JS

              
                //namespace
if (!window.dsijak)
{
    window.dsijak = {};
    window.dsijak.cv = {};
    window.dsijak.cvEl = null;
}

//load once
dsijak.cvEl = {
    ime:                  document.getElementById("ds-input-ime"),
    prezime:              document.getElementById("ds-input-prezime"),
    nazivUlice:           document.getElementById("ds-input-naziv-ulice"),
    kucanskiBroj:         document.getElementById("ds-input-kucanski-broj"),
    mjesto:               document.getElementById("ds-input-mjesto"),
    postanskiBroj:        document.getElementById("ds-input-postanski-broj"),
    mobitel:              document.getElementById("ds-input-broj-mobitela"),
    email:                document.getElementById("ds-input-email"),
    datumRodenja:         document.getElementById("ds-input-datum-rodenja"),
    spolMuski:            document.getElementById("ds-input-spol-muski"),
    spolZenski:           document.getElementById("ds-input-spol-zenski"),
    vozackaDa:            document.getElementById("ds-input-vozacka-da"),
    vozackaNe:            document.getElementById("ds-input-vozacka-ne"),
    pdf:                  document.getElementById("ds-input-zivotopis"),
    pdfHidden:            document.getElementById("ds-input-zivotopis-skriveno"),
    prihvacampravila:     document.getElementById("ds-input-pravila-privatnosti"),
    prihvacampravilaText: document.getElementById("ds-input-pravila-text"),
    
    message:              document.getElementById("ds-message"),
    messageTitle:         document.getElementById("ds-message-title"),
    messageTextBody:      document.getElementById("ds-message-text-body"),
    messageButton:        document.getElementById("ds-message-button"),
}    


dsijak.cv.onSubmit = function()
{
    var validateState = dsijak.cv.validate();
    
    if (validateState)
    {        
        var postData = new FormData();  
              
        var pdfInput = dsijak.cvEl.pdfHidden.files;
        for(var i=0; i<pdfInput.length; i++) {
            postData.append('ds_pdf_file[]', pdfInput[i]);
        }          
        
        var formValues = dsijak.cv.getFormData();      
        postData.append("ds_form_data", JSON.stringify(formValues));  

        dsijak.cv.sendData('/target.php', postData, function(x)
        { 
            dsijak.cv.responseWaiting();
            
            setTimeout(function () {
                                    
                if (x.success)
                {
                    dsijak.cv.responseFinished();
                }
                
                if (x.error)
                {
                    dsijak.cv.responseError(x.error); 
                }
                
                if (x.fail)
                {   
                    dsijak.cv.responseError(x.fail); 
                } 
            
            }, 3000);             
        });         
    }    
}


dsijak.cv.responseWaiting = function()
{  
    dsijak.cv.showWaitingMessage('Šaljem na poslužitelj!'); 
}

dsijak.cv.responseFinished = function()
{   
    dsijak.cv.closeMessage();
    dsijak.cv.successMessage('Poruka je uspješno zaprimljena.');
}

dsijak.cv.responseError = function(text)
{   
    dsijak.cv.closeMessage();
    dsijak.cv.errorMessage(text);
}


dsijak.cv.getFormData = function()
{
    var formData = {};    
    formData.ime = dsijak.cvEl.ime.value;
    formData.prezime = dsijak.cvEl.prezime.value;
    formData.nazivUlice = dsijak.cvEl.nazivUlice.value;
    formData.kucanskiBroj = dsijak.cvEl.kucanskiBroj.value;
    formData.mjesto = dsijak.cvEl.mjesto.value;
    formData.postanskiBroj = dsijak.cvEl.postanskiBroj.value;
    formData.mobitel = dsijak.cvEl.mobitel.value;
    formData.email = dsijak.cvEl.email.value;
    formData.datumRodenja = dsijak.cvEl.datumRodenja.value;
    formData.spol = dsijak.cvEl.spolMuski.checked ? 'M' : 'Ž';
    formData.vozacka = dsijak.cvEl.vozackaDa.checked ? 'Da' : 'Ne';
    formData.pdfFilename = dsijak.cvEl.pdf.value;
    formData.prihvacampravila = dsijak.cvEl.prihvacampravila.checked;

    return formData;
}




//validation
dsijak.cv.validate = function()
{    
    const el = dsijak.cvEl;
    
    if (!el.ime.checkValidity())
    {
        dsijak.cv.setValidationErrorMessage(el.ime);       
    } 
       
    if (!el.prezime.checkValidity())
    {
        dsijak.cv.setValidationErrorMessage(el.prezime);      
    }
    
    if (!el.nazivUlice.checkValidity())
    {
        dsijak.cv.setValidationErrorMessage(el.nazivUlice);      
    }
    
    if (!el.kucanskiBroj.checkValidity())
    {
        dsijak.cv.setValidationErrorMessage(el.kucanskiBroj);      
    }
    
    if (!el.mjesto.checkValidity())
    {
        dsijak.cv.setValidationErrorMessage(el.mjesto);      
    }
    
    if (!el.postanskiBroj.checkValidity())
    {
        dsijak.cv.setValidationErrorMessage(el.postanskiBroj);      
    }
    
    if (!el.mobitel.checkValidity())
    {
        dsijak.cv.setValidationErrorMessage(el.mobitel);      
    }
    
    if (!el.email.checkValidity())
    {
        dsijak.cv.setValidationErrorMessage(el.email);      
    }

    if (el.datumRodenja.value === '1900-12-20' || el.datumRodenja.value === '')
    { 
        dsijak.cv.setValidationErrorMessage(el.datumRodenja);      
    } 
        
    if (el.pdf.value == '')
    {
        dsijak.cv.setValidationErrorMessage(el.pdf); 
    }
    
    if (el.prihvacampravila.checked !== true)
    {
        dsijak.cv.setValidationErrorMessage(el.prihvacampravilaText); 
    }
    
    
    return true;
}


//messages

dsijak.cv.errorMessage = function(text) 
{ 
    const main = dsijak.cvEl.message;
    dsijak.cvEl.messageTitle.innerHTML = 'Pogreška!';
    dsijak.cvEl.messageTextBody.innerHTML = text;
    dsijak.cvEl.messageButton.style.display = 'inline-block';
    main.style.display = 'inline-block';
    main.style.background = '#222';
    throw text; // exit script
}

dsijak.cv.successMessage = function(text)
{
    const main = dsijak.cvEl.message;
    dsijak.cvEl.messageTitle.innerHTML = 'Uspjeh!';
    dsijak.cvEl.messageTextBody.innerHTML = text;
    dsijak.cvEl.messageButton.style.display = 'inline-block';
    main.style.display = 'inline-block';
    main.style.background = 'rgb(0, 52, 174)';
}

dsijak.cv.showWaitingMessage = function(text)
{
    const main = dsijak.cvEl.message;
    dsijak.cvEl.messageTitle.innerHTML = 'Pričekajte!';
    dsijak.cvEl.messageTextBody.innerHTML = text;
    dsijak.cvEl.messageButton.style.display = 'none';
    main.style.display = 'inline-block';
    main.style.background = 'rgb(217, 115, 7)'; 
}

dsijak.cv.closeMessage = function()
{
    dsijak.cvEl.message.style.display = 'none';
    dsijak.cv.clearErrorMarkers();
}

//error markers

dsijak.cv.setValidationErrorMessage = function(elem)
{    
    var message = '';
    
    if (elem.id === 'ds-input-ime')
    {
        if (elem.value === '')
        {
            message = 'Morate unijeti polje "Ime"!';
        }
        else
        {
            message = 'Morate unijeti ispravne podatke u polje "Ime"!';
        }        
    }
    
    if (elem.id === 'ds-input-prezime')
    {        
        if (elem.value === '')
        {
            message = 'Morate unijeti polje "Prezime"!';
        }
        else
        {
            message = 'Morate unijeti ispravne podatke u polje "Prezime"!';
        }       
    }
    
    if (elem.id === 'ds-input-naziv-ulice')
    {        
        if (elem.value === '')
        {
            message = 'Morate unijeti polje "Naziv Ulice"!';
        }
        else
        {
            message = 'Morate unijeti ispravne podatke u polje "Naziv Ulice"!';
        } 
    }
    
    if (elem.id === 'ds-input-kucanski-broj')
    {        
        if (elem.value === '')
        {
            message = 'Morate unijeti polje "Kućanski Broj"!';
        }
        else
        {
            message = 'Morate unijeti ispravne podatke u polje "Kućanski Broj"!';
        }     
    }
    
    if (elem.id === 'ds-input-mjesto')
    {            
        if (elem.value === '')
        {    
            message = 'Morate unijeti polje "Mjesto"!';
        }
        else
        {
            message = 'Morate unijeti ispravne podatke u polje "Mjesto"!';
        }       
    }
    
    if (elem.id === 'ds-input-postanski-broj')
    {        
        if (elem.value === '')
        {
            message = 'Morate unijeti polje "Poštanski Broj"!';
        }
        else
        {
            message = 'Morate unijeti ispravne podatke u polje "Poštanski Broj"!';
        }    
    }
    
    if (elem.id === 'ds-input-broj-mobitela')
    { 
        if (elem.value === '')
        { 
            message = 'Morate unijeti polje "Mobitel"!';
        }
        else
        {
            message = 'Morate unijeti ispravne podatke u polje "Mobitel"!';
        }  
    }
    
    if (elem.id === 'ds-input-email')
    {           
        if (elem.value === '')
        { 
            message ='Morate unijeti polje "Email"!';
        }
        else
        {
            message = 'Morate unijeti ispravne podatke u polje "Email"!';
        } 
    }
    
    if (elem.id === 'ds-input-datum-rodenja')
    {   
        message ='Morate unijeti ispravne podatke u polje "Datum Rodenja"!';
    }
    
    if (elem.id === 'ds-input-zivotopis')
    {        
        message = 'Morate priložiti PDF datoteku!';
    }
    if (elem.id === 'ds-input-pravila-text')
    {        
        message = 'Morate prihvatiti pravila privatnosti!';
    }
    
    elem.style.borderBottom = '1px red solid';
    elem.scrollIntoView({behavior: "smooth", inline: "nearest"});
    dsijak.cv.errorMessage( message );

    return false;
    
}

dsijak.cv.clearErrorMarkers = function()
{
    dsijak.cvEl.ime.style.borderBottom = '1px #ccc solid';
    dsijak.cvEl.prezime.style.borderBottom = '1px #ccc solid';
    dsijak.cvEl.nazivUlice.style.borderBottom = '1px #ccc solid';
    dsijak.cvEl.kucanskiBroj.style.borderBottom = '1px #ccc solid';
    dsijak.cvEl.mjesto.style.borderBottom = '1px #ccc solid';
    dsijak.cvEl.postanskiBroj.style.borderBottom = '1px #ccc solid';
    dsijak.cvEl.mobitel.style.borderBottom = '1px #ccc solid';
    dsijak.cvEl.email.style.borderBottom = '1px #ccc solid';
    dsijak.cvEl.datumRodenja.style.borderBottom = '1px #ccc solid';
    dsijak.cvEl.pdf.style.borderBottom = '1px #ccc solid';
    dsijak.cvEl.prihvacampravilaText.style.borderBottom = '1px #ccc solid';
    
}

dsijak.cv.hideSendButton = function()
{
    messageButton.style.display = 'none';
}

dsijak.cv.showSendButton = function()
{
    messageButton.style.display = 'inline-block';
}

dsijak.cv.sendData = function(url, data, cb)
{        
    var send = async function (url = '', data = {})	
    {	
        const response = await fetch(url, {		
            method: 'POST',
            mode: 'cors',
            cache: 'no-cache',
            credentials: 'same-origin',
            redirect: 'follow',
            referrerPolicy: 'no-referrer',
            body: data
        });

        if (response.status != 200){
            return {error: response.status +', '+ response.statusText};
        } 	
        
        return response.json();
    }
    
    send(url, data)
    .then(data => { 
        if (data.error)
        {
            cb(data);
        }
        else
        {
            cb(data); 
        }		
    });  
}

              
            
!
999px

Console