0
-1
-2
<script type="text/javascript">
$(document).ready( function(){

$('select[name="picname"]')[0].options.add(new Option('Mary Cyndell Budino','Mary Cyndell Budino'));
$('select[name="emailpic"]')[0].options.add(new Option('cyndell.budino@ph.yusen-logistics.com','cyndell.budino@ph.yusen-logistics.com'));
$('select[name="level"], select[name="purpose"]').change(function(){
if($('select[name="level"]').val() === '1' && $('select[name="purpose"]').val() === 'Business Trip' || $('select[name="purpose"]').val() === 'Training')
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Mary Cyndell Budino','Mary Cyndell Budino'));
$('select[name="emailpic"]')[0].options.add(new Option('cyndell.budino@ph.yusen-logistics.com','cyndell.budino@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '1' && $('select[name="purpose"]').val() === 'Hand Carry' || $('select[name="purpose"]').val() === 'Training')
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Rose Leron','Rose Leron'));
$('select[name="emailpic"]')[0].options.add(new Option('rose.leron@ph.yusen-logistics.com','rose.leron@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '2' && $('select[name="purpose"]').val() === 'Business Trip' || $('select[name="purpose"]').val() === 'Training')
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Vida Janda / Errian Katigbak','Vida Janda / Errian Katigbak'));
$('select[name="emailpic"]')[0].options.add(new Option('Executive Assistants','vida.janda@ph.yusen-logistics.com, errian.katigbak@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '3' && $('select[name="purpose"]').val() === 'Business Trip' || $('select[name="purpose"]').val() === 'Training')
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Vida Janda / Errian Katigbak','Vida Janda / Errian Katigbak'));
$('select[name="emailpic"]')[0].options.add(new Option('Executive Assistants','vida.janda@ph.yusen-logistics.com, errian.katigbak@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '4' && $('select[name="purpose"]').val() === 'Business Trip' || $('select[name="purpose"]').val() === 'Training')
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Vida Janda / Errian Katigbak','Vida Janda / Errian Katigbak'));
$('select[name="emailpic"]')[0].options.add(new Option('Executive Assistants','vida.janda@ph.yusen-logistics.com, errian.katigbak@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '5' && $('select[name="purpose"]').val() === 'Business Trip' || $('select[name="purpose"]').val() === 'Training')
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Vida Janda / Errian Katigbak','Vida Janda / Errian Katigbak'));
$('select[name="emailpic"]')[0].options.add(new Option('Executive Assistants','vida.janda@ph.yusen-logistics.com, errian.katigbak@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '6' && $('select[name="purpose"]').val() === 'Business Trip' || $('select[name="purpose"]').val() === 'Training')
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Vida Janda / Errian Katigbak','Vida Janda / Errian Katigbak'));
$('select[name="emailpic"]')[0].options.add(new Option('Executive Assistants','vida.janda@ph.yusen-logistics.com, errian.katigbak@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '7' && $('select[name="purpose"]').val() === 'Business Trip' || $('select[name="purpose"]').val() === 'Training')
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Mary Cyndell Budino','Mary Cyndell Budino'));
$('select[name="emailpic"]')[0].options.add(new Option('cyndell.budino@ph.yusen-logistics.com','cyndell.budino@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '8' && $('select[name="purpose"]').val() === 'Business Trip' || $('select[name="purpose"]').val() === 'Training')
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Mary Cyndell Budino','Mary Cyndell Budino'));
$('select[name="emailpic"]')[0].options.add(new Option('cyndell.budino@ph.yusen-logistics.com','cyndell.budino@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '2' && $('select[name="purpose"]').val() === 'Hand Carry')
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Rose Leron','Rose Leron'));
$('select[name="emailpic"]')[0].options.add(new Option('rose.leron@ph.yusen-logistics.com','rose.leron@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '3' && $('select[name="purpose"]').val() === 'Hand Carry') 
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Rose Leron','Rose Leron'));
$('select[name="emailpic"]')[0].options.add(new Option('rose.leron@ph.yusen-logistics.com','rose.leron@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '4' && $('select[name="purpose"]').val() === 'Hand Carry') 
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Rose Leron','Rose Leron'));
$('select[name="emailpic"]')[0].options.add(new Option('rose.leron@ph.yusen-logistics.com','rose.leron@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '5' && $('select[name="purpose"]').val() === 'Hand Carry') 
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Rose Leron','Rose Leron'));
$('select[name="emailpic"]')[0].options.add(new Option('rose.leron@ph.yusen-logistics.com','rose.leron@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '6' && $('select[name="purpose"]').val() === 'Hand Carry') 
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Rose Leron','Rose Leron'));
$('select[name="emailpic"]')[0].options.add(new Option('rose.leron@ph.yusen-logistics.com','rose.leron@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '7' && $('select[name="purpose"]').val() === 'Hand Carry') 
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Rose Leron','Rose Leron'));
$('select[name="emailpic"]')[0].options.add(new Option('rose.leron@ph.yusen-logistics.com','rose.leron@ph.yusen-logistics.com'));
}
if($('select[name="level"]').val() === '8' && $('select[name="purpose"]').val() === 'Hand Carry') 
{
$('select[name="picname"]').empty();
$('select[name="emailpic"]').empty();
$('select[name="picname"]')[0].options.add(new Option('Rose Leron','Rose Leron'));
$('select[name="emailpic"]')[0].options.add(new Option('rose.leron@ph.yusen-logistics.com','rose.leron@ph.yusen-logistics.com'));
}
});
});

</script>

 

 

 

thats my javascript code but when i go to the next form and this is a subform, it errors. what is wrong?

 

  1. Walter

    Hi there, Try not to write so much of custom code in your app. Things will go out of hand very quickly just like what you are experiencing now. I cannot help you too without you providing steps to replicate your issue. You did not even tell us what error your are getting. Best of luck!

CommentAdd your comment...

1 answer

  1.  
    1
    0
    -1

    Hi Jedi

    Do show the error message or joget.log snippet of the error.

    Thank you

    1. jedi

      actually the error occurs when i complete the next process. code violatioon is displayed.

    2. Matthew King

      Jedi, first test without the javascript code (cut it out from your Joget form). If the error still occurs, then its not the Javascript problem. If there is no error (without Javascript), try getting help just for the Javascript from http://stackoverflow.com/

    CommentAdd your comment...