473,782 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Auto updation problem

1 New Member
Hi all,

I have a javascript that is reloading itself on every menu change, Now the problem is that the values of the product doesn`t reset itself on catalogue change,

the code is

[HTML]
<html>
<head>
<title></title>
</head>
<body>
<SCRIPT language=JavaSc ript>
function reload(form)
{
// Setting the variable with the value of selected country's ID
var val=populate.ca talogue.options[populate.catalo gue.options.sel ectedIndex].value;
self.location=' eform.php?catal ogueId=' + val;
var val2=val+'&cate goryID='+popula te.category.opt ions[populate.catego ry.options.sele ctedIndex].value;
self.location=' eform.php?catal ogueId=' + val2;
var val3=val2+'&pro ductsID='+popul ate.products.op tions[populate.produc ts.options.sele ctedIndex].value;
self.location=' eform.php?catal ogueId=' + val3;
var val3=val2+'&qua ntityID='+popul ate.quantity.op tions[populate.quanti ty.options.sele ctedIndex].value;
self.location=' eform.php?catal ogueId=' + val3;
}
JOptionPane.sho wMessageDialog( frame, "Eggs aren't supposed to be green.");
</script>
<?php
function getCatalogueLis t()
{ $catalogue = array (
'1' => 'Catalogue',
'2' => 'Non - Catalogue',
);
return $catalogue;
}
function getCategoryList ($catalogueId)
{
$category= array (
'Catalogue' => array ('CD', 'SD', 'AG', 'FD', 'CM', 'TB', 'GB', 'TG', 'MD', 'PD' ),
);
return $category[$catalogueId];
}
function getProductList( $categoryID)
{
$products= array (
'CD' =>array ('CD001 ' , ' CD002 ' , ' CD003 ' , ' CD004 ' , ' CD005 ' , ' CD006 ' , ' CD007 ' , ' CD008 ' , ' CD009 ' , ' CD010 ' , ' CD011 ' , ' CD012 ' , ' CD013 ' , ' CD014 ' , ' CD015 ' , ' CD016 ' , ' CD017 ' , ' CD018 ' , ' CD019 ' , ' CD020 ' , ' CD021 ' , ' CD022 ' , ' CD023 ' , ' CD024 ' , ' CD025 ' , ' CD026 ' , ' CD027 ' , ' CD028 ' , ' CD029 ' , ' CD030 ' , ' CD031 ' , ' CD032 ' , ' CD033 ' , ' CD034 ' , ' CD035 ' , ' CD036 ' , ' CD037 ' , ' CD038 ' , ' CD039 ' , ' CD040 ' , ' CD041 ' , ' CD042 ' , ' CD043 ' , ' CD044 ' , ' CD045 ' , ' CD046 ' , ' CD047 ' , ' CD048 ' , ' CD049 ' , ' CD050 ' , ' CD051 ' , ' CD052 ' , ' CD053 ' , ' CD054 ' , ' CD055 ' , ' CD056 ' , ' CD057 ' , ' CD058 ' , ' CD059 ' , ' CD060 ' , ' CD061 ' , ' CD062'),

'SD' => array (' SD001 ' , ' SD002 ' , ' SD003 ' , ' SD004 ' , ' SD005 ' , ' SD006 ' , ' SD007 ' , ' SD008 ' , ' SD009 ' , ' SD010 ' , ' SD011 ' , ' SD012 ' , ' SD013 ' , ' SD014 ' , ' SD015 ' , ' SD016 ' , ' SD017 ' , ' SD018 ' , ' SD019 ' , ' SD020 ' , ' SD021 ' , ' SD022 ' , ' SD023 ' , ' SD024 ' , ' SD025 ' , ' SD026 ' , ' SD027 ' , ' SD028 ' , ' SD029 ' , ' SD030 ' , ' SD031 ' , ' SD032 ' ),

'FD' => array(' FD001 ' , ' FD002 ' , ' FD003 ' , ' FD004 ' , ' FD005 ' , ' FD006 ' , ' FD007 ' , ' FD008 ' , ' FD009 ' , ' FD010 ' , ' FD011 ' , ' FD012 ' , ' FD013 '),

'AG' => array(' AG001 ' , ' AG002 ' , ' AG003 '),

'GB' => array(' GB001 ' , ' GB002 ' , ' GB003 ' , ' GB004 ' , ' GB005 ' , ' GB006 ' , ' GB007 ' , ' GB008 ' , ' GB009 ' , ' GB010 ' , ' GB011 ' , ' GB012 ' , ' GB013 ' , ' GB014 ' , ' GB015 ' , ' GB016 ' , ' GB017 ' , ' GB018 ' , ' GB019 ' , ' GB020 ' , ' GB021 ' , ' GB022 '),

'CM' => array(' CM001 ' , ' CM002 ' , ' CM003 ' , ' CM004 ' , ' CM005 ' , ' CM006 ' , ' CM007 ' , ' CM008 ' , ' CM009 ' , ' CM010 ' , ' CM011 ' , ' CM012 ' , ' CM013 ' , ' CM014 ' , ' CM015 ' , ' CM016 ' , ' CM017 ' , ' CM018 ' , ' CM019 ' , ' CM020 ' , ' CM021 ' , ' CM022 ' , ' CM023 ' , ' CM024 ' , ' CM025 ' , ' CM026 ' , ' CM027 ' , ' CM028 ' , ' CM029 ' , ' CM030 ' , ' CM031 ' , ' CM032 ' , ' CM033 '),

'TB' => array( ' TB001 ' , ' TB002 ' , ' TB003 ' , ' TB004 ' , ' TB005 ' , ' TB006 ' , ' TB007 ' , ' TB008 ' , ' TB009 ' , ' TB010 ' , ' TB011 ' , ' TB012 ' , ' TB013 '),

'TG' => array(' TG001 ' , ' TG002 ' , ' TG003 ' , ' TG004 ' , ' TG005 ' , ' TG006 ' , ' TG007 ' , ' TG008 ' , ' TG009 ' , ' TG010 ' , ' TG011 ' , ' TG012 ' , ' TG013 ' , ' TG014 ' , ' TG015 ' , ' TG016 ' , ' TG017 ' , ' TG018 ' , ' TG019 ' , ' TG020 ' , ' TG021 ' , ' TG022 ' ),

'MD' => array(' MD001 ' , ' MD002 ' , ' MD003 ' , ' MD004 ' , ' MD005 ' , ' MD006 ' , ' MD007 ' , ' MD008 ' , ' MD009 ' , ' MD010 ' , ' MD011 '),

'PD' => array( ' PD001 ' , ' PD002 ' , ' PD003 ' ),

);
return $products[$categoryID];
}
?>

<form action="eform.p hp" name="populate" method="post">
<?
// Retrieving the country list
$catalogue = getCatalogueLis t();

// Setting the variable if the country is selected for its city list
@$catalogueId = $_GET['catalogueId'];
@$categoryID = $_GET['categoryID'];
@$productsID = $_GET['productsID'];

// Retrieving the city list if a country is selected
$category= ($catalogueId) ? getCategoryList ($catalogueId) : null;
$products= ($categoryID) ? getProductList( $categoryID) : null;
if (!empty($catalo gue))
{
// Generating the catalogue drop down menu
echo "<select onChange='reloa d(this.form)' name='catalogue '>";
foreach ($catalogue as $value)
{
echo "<option value='$value'" ;
if ($catalogueId == $value)
echo "selected";
echo ">$value</option>";

}
echo "</select>";
}
if (!empty($catego ry))
{
// Generating the category drop down menu if a catalogue is selected
echo "<select onChange='reloa d(this.form)' name='category' >";
foreach ($category as $value)
{
echo "<option value='$value'" ;
if ($categoryID == $value)
echo "selected";
echo ">$value</option>";
}
echo "</select>";
}
if (!empty($produc ts))
{
// Generating the products drop down menu if a country is selected
echo "<select onChange='reloa d(this.form)' name='products' >";
foreach ($products as $value)
{
echo "<option value='$value'" ;
if ($productsID== $value)
echo "selected";
echo ">$value</option>";
}
echo "</select>";
}
?>
</body>
</html>
[/HTML]

I want the Product also to be resetted on changing the catalgoue value
Aug 30 '07 #1
1 1485
phvfl
173 Recognized Expert New Member
Hi,

Welcome to TSDN...

Just have to ask a few questions first as I am not fluent with PHP so I want to make sure that I understand all the client side stuff.

Whenever any of the selects (catalogue, category, products) are changed you refresh the page using the reload javascript. You then parse the values of the select boxes so that the values can be added into the querysring and you redirect the browser so that the page can be refreshed on the server side.

If this is the case then there are a couple of issues that seem to effect this. Firstly you are repeatedly using the self.location property. You should avoid doing this as what would happen if that four calls to the server are issued, one for each of the self.location statements. If you build up your querystring and then do one self.location change this should improve the script.

Secondly you try to use the value of an option for quantity, this does not seem to be in the HTML, in the javascript it also assigns this to val3 which is already used for category.

I would try the javascript as follows:
Expand|Select|Wrap|Line Numbers
  1. function reload(form){
  2.  
  3. // Setting the variable with the value of selected country's ID
  4.  
  5. var $catalogue = populate.catalogue.options[populate.catalogue.options.selectedIndex].value;
  6.  
  7. var $category = populate.category.options[populate.category.options.selectedIndex].value;
  8.  
  9. var $products populate.products.options[populate.products.options.selectedIndex].value;
  10.  
  11. self.location='eform.php?catalogueId=' + $catalogue + '&categoryID=' + $category + '&products=' + $products;
  12. }
  13.  
I have loaded the values of the options into variables and then built up the redirection URL and done the redirect the once.

Hope this helps

P.S. The dollar notation is just something that I use to help distinguish variables in javascript and make sure that I don't use any reserved words for variable names. It will not interfere with the PHP.
Aug 30 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1412
by: AA | last post by:
We want to edit, update data of DataGrid in Asp.Net with VB.Net.and are writing the following code for EditCommand and UpdateCommand Event is : DataGrid1_EditCommand
0
1078
by: Lakshmi Narayanan.R | last post by:
Hi Experts I am new to .NET. I need great explanation for "the updation in the disconnected data". How it is handled. That is, if mutiple user is interacting with the data, one will delete another will insert or update. So after the modifications how the correct updation is made in the database table. What the hidden mechanism is there. The updation logic is confusing Pls help me, if any articles available let me know them Thanks in...
1
1217
by: Babz | last post by:
Hi, How I can prevent concurrent updation of a records in .net. I am using Dataset which is disconnected from the data source. In this situation if two users opens the same record, modifies the data and updates one after another, my data won't be in the correct state. How I can prevent this. Is there any locking technics.
1
2039
by: r2destini | last post by:
Hi Friends, I am new to .Net. So I don't know much. I am facing a problem in updating database through ADO.Net I am creating the dataset and there is no problem in the updation and deletion or insertion in the dataset but when I am updating the
0
1297
by: prashant | last post by:
Hi, I am trying to set up Transactional replication with immediate updation. The configuration is as follows: 1. Publisher is SQL server 2000 Enterprise Edition, and Distributor is on the same server. 2. Publisher SQL server is installed on Windows 2003.
0
819
by: hellboss | last post by:
Hi Everyone ! Im using asp.net vs05 , I have a Couple of Table adapter ( in the Xsd file) which is used for updation and Insertion and viewing , What i Exactly needed is a code to Auto Configure the Table adapter automatically now and then, bcos my table structure may change from time to time. Is their any code for Auto Configuring (may be if i might put these code in some button click event) ,if So Kindly provide me with Code , ...
1
1838
by: roshan56us | last post by:
Hi, i have problem in updation of access database, which is in backend and Visual basic as front end. its using 800 records in MS-Access but,while updating the database, it doesn't update sometime or sometime it takes two to three times in updation.and sometime application has to be closed and then reopened ,then update. and it get updated.
2
1403
by: jestin | last post by:
hi friends we have a ASP intranet system and its backend is in MSAccess now we r upgrading its back end with Oracle 8i. and i have a problem regarding the record set updation the code is as follows Set rscustomer = server.CreateObject("ADODB.Recordset") rscustomer.Open sqlcustomer, MMToConn, 1, 3 '---- '----
1
1684
by: siri11 | last post by:
Hi everyone!!!!!!!!! If i update a record in a table in sqlserver from front end (c#.net),using a stored procedure for updating then after updation if i open the table then it is showing the same record 2 times i.e before updation record and after updation record..Plzzzzzzzz help me how to solve this problem....its very urgent...Plzzzzzzzzzz Thanks in advance siri
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9479
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10311
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8967
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7492
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6733
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2874
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.