• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Javascript question

Javascript question 13 years 7 months ago #11543

  • parelweb
  • parelweb's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 13
I'm working with a form in wich i encounter a problem due to my lack of javascriptknowledge.

I've a field “lint_kaart” with the following attribute: onChange="displayField();"
In this field there are four choices possible “Geen, Lint, Rouwkaart en Lintkaart”
  • if selection in field “lint_kaart” is “Geen” neither of the following fields must be shown “lint_kleur”, “lint_afscheid”, “lint_namen”, ‘voorzijde” en “achterzijde”.
  • if selection in field “lint_kaart” is “Lint” only the following fields must be shown “lint_kleur”, “lint_afscheid” en “lint_namen”.
  • if selection in field “lint_kaart” is “Rouwkaart” only the following fields must be shown “voorzijde” en “achterzijde”
  • if selection in field “lint_kaart” is “Lintkaart” only the following fields must be shown “voorzijde” en “achterzijde”

I also have a field “bezorglocatie” with the attribute: onChange="displayField();"
only if selectio in the field “bezorglocatie” is “Overig” the field “adres_2” must be shown.

I've made a script but i can't get it to work properly. Can someone help me with it?

<script type="text/javascript">
function displayField()
{
if(document.getElementById('lint_kaart').value == 'Lint') {
document.getElementById('lint_kleur').style.display = "";
document.getElementById('lint_afscheid').style.display = "";
document.getElementById('lint_namen').style.display = "";
document.getElementById('voorzijde').style.display = "none"; 
document.getElementById('achterzijde').style.display = "none";
}
else {
if(document.getElementById('lint_kaart').value == 'Rouwkaart') {
document.getElementById('lint_kleur').style.display = "none";
document.getElementById('lint_afscheid').style.display = "none";
document.getElementById('lint_namen').style.display = "none";
document.getElementById('voorzijde').style.display = ""; 
document.getElementById('achterzijde').style.display = "";
document.getElementById('helement').className = "formNoError";
}
else {
if(document.getElementById('lint_kaart').value == 'Lintkaart') {
document.getElementById('lint_kleur').style.display = "none";
document.getElementById('lint_afscheid').style.display = "none";
document.getElementById('lint_namen').style.display = "none";
document.getElementById('voorzijde').style.display = ""; 
document.getElementById('achterzijde').style.display = ""; 
document.getElementById('helement').className = "formNoError";
}
else {
if(document.getElementById('bezorglocatie').value == 'Overig') {
document.getElementById('adres_2').style.display = ""; 
}
else {
document.getElementById('adres_2').style.display="none";
document.getElementById('bezorglocatie').value="";
document.getElementById('helement').className = "formNoError";
}
}
 
window.addEvent('domready', function() {
displayField();
});
</script>

Thanks,
Hans
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!