473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

hidden data - best practice, best way, suggestions

I have two sets of text strings. They are related to each other and
are not proprietary. X group contains about 2000 short, one to three
word, strings. Y contains about 50. These two groups supply the
option items in two select boxes. Box Y scopes the items allowed in
select box X. As selections in Y are made, optional items in X
change.

I’ve never hidden so much data before and wondered if there is a best
way to do this. I intended to create a string, comma delimited, of X
Y pairs, and when the information is required for use, split it and
either consider the data immediately or park it in an array for a next
process step.

Call backs to the server have been considered and rejected. The data
must accompany the page.

Thanks.
Sep 10 '08 #1
1 1274
On Wed, 10 Sep 2008 12:29:49 -0700, oldyork90 wrote:
I have two sets of text strings. They are related to each other and are
not proprietary. X group contains about 2000 short, one to three word,
strings. Y contains about 50. These two groups supply the option items
in two select boxes. Box Y scopes the items allowed in select box X.
As selections in Y are made, optional items in X change.

I’ve never hidden so much data before and wondered if there is a best
way to do this. I intended to create a string, comma delimited, of X Y
pairs, and when the information is required for use, split it and either
consider the data immediately or park it in an array for a next process
step.

Call backs to the server have been considered and rejected. The data
must accompany the page.

Thanks.
From your description, look at storing your data in an object, rather
than multiple arrays. (Objects, in Javascript, are very similar
associative arrays in other languages, though there are some difference.)

/* Untested syntax */

var myObject = {
"car" : ["ford", "chevy", "vw"],
"boat" : ["rowboat"]
}

To access the members, you would do something like:
for (key in myObject) {
if myObject.hasOwnProperty(key) {
alert(key);
}
}

Will alert "car" and "boat"

To look at the options for car and boat, I would do:
key = "car";
var myArray = myObject[key];

for (var i = 0; i < myArray.length; i++) {
alert(myArray[i]);
}

If this data is fairly static, make it an .js file and script it in to
your page to take advantage of caching.
Sep 10 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Andrew Durstewitz | last post by:
Hi! I am having a really strange issue. I have a few users calling in saying they are getting an error. On further review I found this line is what is causing it... Set strLookup =...
1
by: James E | last post by:
I have a question about best practices of how to deal with lookup data from my C# apps. On a couple of occasions I have come across a problem where I have to automate inserting a record into a...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
2
by: Duncan Welch | last post by:
I'm working with 4 websites running on the same box with seperate IIS sites (I can't change this) - 3 that display information from a database, and one that collects it and writes to the same...
4
by: WB | last post by:
Hi, I need to validate a hidden input in my webform to ensure that it's got value. The controls look something like this: <input id="HidSelectedStates" type="hidden" runat="server" /><br...
19
by: Badr.ALmuzini | last post by:
hi,there how can i make php file extension hidden in the URL somthing like this (http://mail.google.com/mail/?view) Regard....
3
by: Furty | last post by:
Hi, I'm looking for the best practice for creating a generic data validation implementation for my data bound business objects. I currently have a business object base class implementing the...
4
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which -...
9
by: =?Utf-8?B?QW1tZXI=?= | last post by:
I've read many incomplete opinions about the "Best Practice" for securely accessing SQL but what I really need to find the "Best Practice" that fits my applications needs. Currently (alpha...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.