Jump to content

Addin accardeon button to registration form makes page to refresh after few seconds. HELP please


onlyomaha

Recommended Posts

So i have added this code to authentication.tpl

 

 

 

 

 

<!DOCTYPE html>
<html>
<head>
<style>
button.accordion {
    background-color: #f6944b;
    color: white;  
    cursor: pointer;
    padding: 18px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 15px;
    transition: 0.4s;
}
 
button.accordion.active, button.accordion:hover {
    background-color: #f6944b;
    color: black;
}
 
div.panel {
    padding: 0 18px;
    background-color: white;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
}
</style>
</head>
<body>
 
<button class="accordion">Juridiskām personām</button>
 
<div class="panel">
<div class="account_creation">
<h3 class="page-subheading">{l s='Your company information'}</h3>
<p class="form-group">
<label for="">{l s='Company'}</label>
<input type="text" class="form-control" id="company" name="company" value="{if isset($smarty.post.company)}{$smarty.post.company}{/if}" />
</p>
 
 
 
<div class="form-group">
    <label for="my_field">{l s='Reģistrācijas numurs'}</label>
    <input id="my_field" class="form-control" name="my_field" type="text" value="{if isset($smarty.post.my_field)}{$smarty.post.my_field}{/if}" />
    <span class="form_info">{l s='obligāts lauciņš priekš juridiskās personas'}</span>
</div>
<div class="form-group">
    <label for="my_field">{l s='PVN maksātāja numurs:'}</label>
    <input id="my_field" class="form-control" name="my_field" type="text" value="{if isset($smarty.post.my_field)}{$smarty.post.my_field}{/if}" />
    <span class="form_info">{l s='obligāts lauciņš priekš juridiskās personas'}</span>
</div>
<div class="form-group">
    <label for="my_field">{l s='Bankas nosaukums:'}</label>
    <input id="my_field" class="form-control" name="my_field" type="text" value="{if isset($smarty.post.my_field)}{$smarty.post.my_field}{/if}" />
    <span class="form_info">{l s='obligāts lauciņš priekš juridiskās personas'}</span>
</div>
 
<div class="form-group">
    <label for="my_field">{l s='Bankas kods:'}</label>
    <input id="my_field" class="form-control" name="my_field" type="text" value="{if isset($smarty.post.my_field)}{$smarty.post.my_field}{/if}" />
    <span class="form_info">{l s='obligāts lauciņš priekš juridiskās personas'}</span>
</div>
<div class="form-group">
    <label for="my_field">{l s='Bankas konta numurs:'}</label>
    <input id="my_field" class="form-control" name="my_field" type="text" value="{if isset($smarty.post.my_field)}{$smarty.post.my_field}{/if}" />
    <span class="form_info">{l s='obligāts lauciņš priekš juridiskās personas'}</span>
</div>
 
 
</div>
</div>
 
<script>
var acc = document.getElementsByClassName("accordion");
var i;
 
for (i = 0; i < acc.length; i++) {
  acc.onclick = function() {
    this.classList.toggle("active");
    var panel = this.nextElementSibling;
    if (panel.style.maxHeight){
   panel.style.maxHeight = null;
    } else {
   panel.style.maxHeight = panel.scrollHeight + "px";
    } 
  }
}
</script>
 
 
 
</body>
</html>
 
 
It works fine as i wanted but i have problem, it refreshes page after 1 second and page goes 1 step back to entering email.  Whats wrong with code? How to prevent it? please help ;) 

post-1363992-0-50540300-1487540768_thumb.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...