I have this script...
[CODE=javascript]
var td = document.create Element('td');
var p = document.create Element('p');
var label = document.create Element('label' );
var span = document.create Element('span') ;
var theData = document.create TextNode('Chart Of Account');
var theSelect = document.create Element('select ');
theSelect.setAt tribute('name', 'items['+item_count+'][pbdccoa]');
var opCol = document.create Element('option ');
opCol.setAttrib ute('value', '');
var opColTxt = document.create TextNode('<?php echo $this->lang->line('select_c oa')?>');
opCol.appendChi ld(opColTxt);
theSelect.appen dChild(opCol);
<?php foreach($coa_li st->result() as $coa): ?> var opCol = document.create Element('option ');
opCol.setAttrib ute('value', '<?php echo $coa->ccbcCoa?>');
var opColTxt = document.create TextNode('<?php echo $coa->ccbcCoa?>');
opCol.appendChi ld(opColTxt);
theSelect.appen dChild(opCol);
<?php endforeach; ?>
opCol.onselect = function(){
if (this.getAttrib ute('value')==n ull || this.getAttribu te('value')=="" ){
alert("Require field");
}
}
span.appendChil d(theData);
label.appendChi ld(span);
label.appendChi ld(theSelect);
p.appendChild(l abel);
td.appendChild( p);
row.appendChild (td);
[/CODE]
With this command below i want to check the value of drop down list, if user select a null value of drop down list, than it will show an alert window ("Require Field").
But it doesn;t work well, any idea??thanks for helping me..
[CODE=javascript]
var td = document.create Element('td');
var p = document.create Element('p');
var label = document.create Element('label' );
var span = document.create Element('span') ;
var theData = document.create TextNode('Chart Of Account');
var theSelect = document.create Element('select ');
theSelect.setAt tribute('name', 'items['+item_count+'][pbdccoa]');
var opCol = document.create Element('option ');
opCol.setAttrib ute('value', '');
var opColTxt = document.create TextNode('<?php echo $this->lang->line('select_c oa')?>');
opCol.appendChi ld(opColTxt);
theSelect.appen dChild(opCol);
<?php foreach($coa_li st->result() as $coa): ?> var opCol = document.create Element('option ');
opCol.setAttrib ute('value', '<?php echo $coa->ccbcCoa?>');
var opColTxt = document.create TextNode('<?php echo $coa->ccbcCoa?>');
opCol.appendChi ld(opColTxt);
theSelect.appen dChild(opCol);
<?php endforeach; ?>
opCol.onselect = function(){
if (this.getAttrib ute('value')==n ull || this.getAttribu te('value')=="" ){
alert("Require field");
}
}
span.appendChil d(theData);
label.appendChi ld(span);
label.appendChi ld(theSelect);
p.appendChild(l abel);
td.appendChild( p);
row.appendChild (td);
[/CODE]
With this command below i want to check the value of drop down list, if user select a null value of drop down list, than it will show an alert window ("Require Field").
Code:
if (this.getAttribute('value')==null || this.getAttribute('value')==""){
alert("Require field");
}
}
But it doesn;t work well, any idea??thanks for helping me..
Comment