if( isset($_SESSION['is_user']) && isset($_SESSION['is_pass']) && isset($_SESSION['is_group'])){
$q_session = mysql_query("SELECT * FROM si_user u, si_group g, si_location l
WHERE u.group_id=g.group_id AND
u.location_id=l.location_id AND
active='y' AND
username='".$_SESSION['is_user']."' AND
password='".$_SESSION['is_pass']."' ");
$r_session = mysql_fetch_array($q_session);
}
$php_self = $_SERVER['PHP_SELF'];
include('header.php');
?>
Last edited by lord_aragon; 02-02-2009 at 05:12 AM.
$q_part_hp = mysql_query("SELECT p.*, v.vendor_name FROM si_part p
LEFT JOIN si_vendor v ON p.vendor_id = v.vendor_id
ORDER BY vendor_name, hp_part_no, vendor_part_no ");
while($r_part_hp = mysql_fetch_array($q_part_hp)){
$arr_v_name[] = $r_part_hp[vendor_name];
$arr_part_v[] = $r_part_hp[vendor_part_no];
$arr_part_hp[] = $r_part_hp[hp_part_no];
$arr_part_idx[] = $r_part_hp[part_id];
$arr_part_desc[] = $r_part_hp[part_desc];
$q_get_stock = mysql_query("SELECT * FROM si_part_summary
WHERE location_id='$r_session[location_id]' AND
vendor_part_no='$r_part_hp[vendor_part_no]' AND
hp_part_no='$r_part_hp[hp_part_no]'
");
<script type="text/javascript">
function cek_case()
{
var dobelCase = '<?=$dobel_case?>';
if(dobelCase == 'yes'){
if (confirm('Case ID is already in database. Are you sure you want to use this case ID again?'))
{
return true;
}
else
{
return false;
}
}
else{
return true;
}
}
//-->
</SCRIPT>
<script type="text/javascript">
var StartIteration = 2;
function addRowToTable()
{
var LastIteration = this.StartIteration++;
var tbl = document.getElementById('table1');
var RowsLength = tbl.rows.length;
var row = tbl.insertRow(RowsLength);
row.setAttribute('id' ,'tr' + LastIteration);
row.setAttribute('bgColor' ,'#F0F6FB');
row.setAttribute('valign' ,'top');
var cellRight1 = row.insertCell(0);
var divTag = document.createElement("div");
divTag.id = "v_name" + LastIteration;
cellRight1.appendChild(divTag);
var cellRight2 = row.insertCell(1);
cellRight2.setAttribute('align','center');
var sel1 = document.createElement('select');
sel1.options[0] = new Option('', '');
<? foreach($arr_part_v as $key => $value){ ?>
sel1.options[<?=$key+1?>] = new Option("<?=$value?>", "");
<? } ?>
function removeRowFromTable(rw, n)
{
var row = document.getElementById(rw).rowIndex;
var tbl = document.getElementById('table1');
var lastRow = tbl.rows.length;
?>
<tr id="tr1" bgcolor="#F0F6FB" valign="top">
<td><div id="v_name<?=$i;?>"></div></td>
<td align="center"><select id="v_part_no<?=$i;?>" name="part_id<?=$i;?>" onchange="
document.getElementById('v_name<?=$i;?>').innerHTML=this.options[this.selectedIndex].dir;
document.getElementById('part_desc<?=$i;?>').innerHTML=this.options[this.selectedIndex].title;
document.getElementById('balance<?=$i;?>').innerHTML=this.options[this.selectedIndex].id;
document.getElementById('onhandce<?=$i;?>').innerHTML=this.options[this.selectedIndex].lang;
document.getElementById('hp_part_no<?=$i;?>').value=this.options[this.selectedIndex].value;
">
<option></option>
<?php
$q_hp_part_no = mysql_query("SELECT p.*, v.vendor_name FROM si_part p
LEFT JOIN si_vendor v ON p.vendor_id = v.vendor_id
ORDER BY vendor_name, hp_part_no, vendor_part_no ");
while( $r_hp_part_no = mysql_fetch_array($q_hp_part_no) ){
$q_cek_stock = mysql_query("SELECT * FROM si_part_summary
WHERE location_id='$r_session[location_id]' AND
vendor_part_no='$r_hp_part_no[vendor_part_no]' AND
hp_part_no='$r_hp_part_no[hp_part_no]'
");
<td align="center">
<select id="hp_part_no<?=$i;?>" name="part_id<?=$i;?>" onchange="
document.getElementById('v_name<?=$i;?>').innerHTML = this.options[this.selectedIndex].dir;
document.getElementById('part_desc<?=$i;?>').innerHTML = this.options[this.selectedIndex].title;
document.getElementById('balance<?=$i;?>').innerHTML = this.options[this.selectedIndex].id;
document.getElementById('onhandce<?=$i;?>').innerHTML = this.options[this.selectedIndex].lang;
document.getElementById('v_part_no<?=$i;?>').value = this.options[this.selectedIndex].value;
">
<option></option>
<?php
$q_hp_part_no = mysql_query("SELECT p.*, v.vendor_name FROM si_part p
LEFT JOIN si_vendor v ON p.vendor_id = v.vendor_id
ORDER BY vendor_name, hp_part_no, vendor_part_no ");
while( $r_hp_part_no = mysql_fetch_array($q_hp_part_no) ){
$q_cek_stock = mysql_query("SELECT * FROM si_part_summary
WHERE location_id='$r_session[location_id]' AND
vendor_part_no='$r_hp_part_no[vendor_part_no]' AND
hp_part_no='$r_hp_part_no[hp_part_no]'
");
there is some event <select> onchange on default row (row 1) and it works on all browser Opera, IE, Firefox, and then i've been made an javascript to make another without reloading the page and it should have the same parameter as row one, anything is ok except event onChange that created dynamicly by javascript not works on IE also Firefox
please help me,,,i'm still newbie in javascript/ajax...give me the best solution..
sel2.onchange=function(LastIteration) {
return function (e) {
document.getElementById('v_name'+LastIteration).innerHTML=this.options[this.selectedIndex].dir;
document.getElementById('balance'+LastIteration).innerHTML=this.options[this.selectedIndex].id;
document.getElementById('onhandce'+LastIteration).innerHTML=this.options[this.selectedIndex].lang;
document.getElementById('part_desc'+LastIteration).innerHTML=this.options[this.selectedIndex].title;
document.forms[0].elements['v_part_no'+LastIteration].value=this.options[this.selectedIndex].value; // uncertain if this is correct
};
}(LastIteration);
Large scripts can be zipped and posted
Last edited by Fang; 02-02-2009 at 06:23 AM.
At least 98% of internet users' DNA is identical to that of chimpanzees
but i 'm still miss one thing, when using firefox and IE, in the Vendor name column created by javascript, there is not displayed the vendor name that represented from event <select> onchange that call "dir" parameter on the <option> element
there is any suggestion for displaying an a text that calls from <option> parameter
value => will set another <select> to the same value
dir => will set <div> inner HTML on the Vendor name column
id => will set <div> inner HTML on the Balance column
lang => will set <div> inner HTML on the On Hand CE column
title => will set <div> inner HTML on the Part Name column
thanks again @Fang, this javasript almost makes me crazy,, cause this application should running well in popular browser like Opera, Firefox and IE. and fortunately i found this forums that discuss all about web developing, and i want to learnmore about javascipt from this site. .my method that i'm used for the <option> attribute is the way that i know, and i don't have any idea again.
but i think like this, all text that i want to show to <div> element of Vendor name, part name, balance and On Hand CE column is joined in one <option> attributes like title and separated by special characters like ' ; ' or others, and the Javasript will read the title attribute and split text by ' ; ' and the result will set the values of the <div> element before. How to make action like this?
is there any better method to make event onchange like this? i'll be appreciated if you can give another method
Last edited by lord_aragon; 02-03-2009 at 09:04 PM.
Bookmarks