473,587 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Removing duplicate values Javascript

Hi all,

I have a form that contains a lot of values. On this form there are
also alot of popups that can be brought up. One of them does the
following: Takes 2 values (x and y), concatenates them together with
an underscore in between and adds them to a select box in the same
popup (z). Then, when a user clicks a save button located on the
popup, it sends that information back to the main form and populates
the same three values (x, y, and z). What I need to do is make sure
that there are no duplicates in the x and y boxes on the main screen
before they proceed to the next step.

Any suggestions?

Thanks

Kosta

May 3 '07 #1
5 2451
I forgot to mention....when the values get sent back to the main form,
they are comma separated. Also, the original x and y values are
broken down (i.e. split on a comma, then split on the underscore to
retrieve the original values).

Thanks.
On May 3, 9:44 am, kosta.triantafi l...@gmail.com wrote:
Hi all,

I have a form that contains a lot of values. On this form there are
also alot of popups that can be brought up. One of them does the
following: Takes 2 values (x and y), concatenates them together with
an underscore in between and adds them to a select box in the same
popup (z). Then, when a user clicks a save button located on the
popup, it sends that information back to the main form and populates
the same three values (x, y, and z). What I need to do is make sure
that there are no duplicates in the x and y boxes on the main screen
before they proceed to the next step.

Any suggestions?

Thanks

Kosta

May 3 '07 #2
Lee
ko************* ****@gmail.com said:
>
I forgot to mention....when the values get sent back to the main form,
they are comma separated. Also, the original x and y values are
broken down (i.e. split on a comma, then split on the underscore to
retrieve the original values).

Thanks.
On May 3, 9:44 am, kosta.triantafi l...@gmail.com wrote:
>Hi all,

I have a form that contains a lot of values. On this form there are
also alot of popups that can be brought up. One of them does the
following: Takes 2 values (x and y), concatenates them together with
an underscore in between and adds them to a select box in the same
popup (z). Then, when a user clicks a save button located on the
popup, it sends that information back to the main form and populates
the same three values (x, y, and z). What I need to do is make sure
that there are no duplicates in the x and y boxes on the main screen
before they proceed to the next step.
You're going to have to explain more clearly and precisely.
You haven't told us anything about your "x and y boxes", or
what it means to "proceed to the next step". I link to a
page would be helpful, or post the smallest example you can
contrive.
--

May 3 '07 #3
I can't really provide a link to this, as it is for a client and it is
confidential.

Basically, there are three metadata fields: H Number, PBP Number, and
Plan Code. The H Number and PBP Number combine together to form the
Plan Code (i.e. H Number = 111, PBP Number = 222, Plan Code =
111_222).

The main form will contain these three boxes:

Plan Code: __________ [button to click for popup window]
H Number:________ _ [read only text box]
PBP Number: ________ [read only text box]

When someone clicks the button next to the Plan Code, it brings up a
pop window that contains a combo box for both the H Number and PBP
Number, and a select box for the Plan Code. A user will then enter an
H Number and PBP Number, and click an Add button located next to it.
This Add button calls a function that concats the H Number and PBP
Number together with an underscore in between. At the bottom of the
popup window is a Save button. Clicking this will send the Plan Code
information back to the main form. It will also split the Plan Code
value back into the original H and PBP Numbers and send that back to
the original form as well. Final result will look like this:

Plan Code: 111_222
H Number: 111
PBP Number: 222

What I need to do is ensure that there are no duplicate values for the
H and PBP Numbers on the main form. In other words, it CANNOT look
like this:

H Number: 111, 111
PBP Number: 222, 222

Any suggestions on how I can filter this out? Should I do it before I
hit the Save button?

Thanks alot,
Kosta

On May 3, 10:20 am, Lee <REM0VElbspamt. ..@cox.netwrote :
kosta.triantafi l...@gmail.com said:


I forgot to mention....when the values get sent back to the main form,
they are comma separated. Also, the original x and y values are
broken down (i.e. split on a comma, then split on the underscore to
retrieve the original values).
Thanks.
On May 3, 9:44 am, kosta.triantafi l...@gmail.com wrote:
Hi all,
I have a form that contains a lot of values. On this form there are
also alot of popups that can be brought up. One of them does the
following: Takes 2 values (x and y), concatenates them together with
an underscore in between and adds them to a select box in the same
popup (z). Then, when a user clicks a save button located on the
popup, it sends that information back to the main form and populates
the same three values (x, y, and z). What I need to do is make sure
that there are no duplicates in the x and y boxes on the main screen
before they proceed to the next step.

You're going to have to explain more clearly and precisely.
You haven't told us anything about your "x and y boxes", or
what it means to "proceed to the next step". I link to a
page would be helpful, or post the smallest example you can
contrive.

--- Hide quoted text -

- Show quoted text -

May 3 '07 #4
Lee
ko************* ****@gmail.com said:
>
I can't really provide a link to this, as it is for a client and it is
confidential .

Basically, there are three metadata fields: H Number, PBP Number, and
Plan Code. The H Number and PBP Number combine together to form the
Plan Code (i.e. H Number = 111, PBP Number = 222, Plan Code =
111_222).

The main form will contain these three boxes:

Plan Code: __________ [button to click for popup window]
H Number:________ _ [read only text box]
PBP Number: ________ [read only text box]

When someone clicks the button next to the Plan Code, it brings up a
pop window that contains a combo box for both the H Number and PBP
Number, and a select box for the Plan Code. A user will then enter an
H Number and PBP Number, and click an Add button located next to it.
This Add button calls a function that concats the H Number and PBP
Number together with an underscore in between. At the bottom of the
popup window is a Save button. Clicking this will send the Plan Code
information back to the main form. It will also split the Plan Code
value back into the original H and PBP Numbers and send that back to
the original form as well. Final result will look like this:

Plan Code: 111_222
H Number: 111
PBP Number: 222

What I need to do is ensure that there are no duplicate values for the
H and PBP Numbers on the main form. In other words, it CANNOT look
like this:

H Number: 111, 111
PBP Number: 222, 222

Any suggestions on how I can filter this out? Should I do it before I
hit the Save button?
I still don't know enough to give a detailed answer, but
at some point you need to maintain a list of values that
have already been added, and compare the new values to
each element in the list. Is it pairs of numbers (eg 111_222)
that you want to avoid duplicating, or individual numbers.
For example, could you have plan codes 111_222 and 111_333,
and, in that case, do you allow:
Plan Code: 111_222, 111_333
H Number: 111
PBP Number: 222, 333
--

May 4 '07 #5
kosta.triantafi l...@gmail.com wrote:
[...]
What I need to do is ensure that there are no duplicate values
for the H and PBP Numbers on the main form. In other words,
it CANNOT look like this:
H Number: 111, 111
PBP Number: 222, 222
var P = ['11, 22', 'def, def', 'q,q', 'AG, Ag', '111, 111']
display(P)
var newP = new Array()
for (var i = 0; i<P.length; ++i) {
var spl = P[i].split(', ') // space after comma
if (spl[0] != spl[1])
newP.push(P[i]);
}
display(newP)

function display(arr) {
document.write( '<hr>')
for (var j = 0; j<arr.length; ++j)
document.write( arr[j]+'<br>');
}

Hope this helps,

--
Bart

May 5 '07 #6

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

Similar topics

2
3667
by: Iain | last post by:
Hi I have inherited a web app with the following table structure, and need to produce a table without any duplicates. Email seems like the best unique identifier - so only one of each e-mail address should be in the table. Following http://www.sqlteam.com/item.asp?ItemID=3331 I have been able to get a duplicate count working: select...
7
7928
by: Utter Newbie | last post by:
Just wondeing if there is a way to keep from having a certain parameter sent when posting a form to another page (method=get)... So as an example a page will post something like this from a form using "get": http://mypage?firstElement=1&secondElement=2 How can you completely remove "secondElement=2" from the querystring... Before...
9
5083
by: vbportal | last post by:
Hi, I would like to add BitArrays to an ArrayList and then remove any duplicates - can someone please help me forward. I seem to have (at leaset ;-) )2 problems/lack of understanding (see test code below): (a)When adding BitArrays to the ArrayList and then looping through the ArrayList I seem to access only the latest added BitArray and I'm...
24
4363
by: RyanTaylor | last post by:
I have a final coming up later this week in my beginning Java class and my prof has decided to give us possible Javascript code we may have to write. Problem is, we didn't really cover JS and what we covered was within the last week of the class and all self taught. Our prof gave us an example of a Java method used to remove elements from an...
4
4381
by: sri2097 | last post by:
Hi all, I'm storing number of dictionary values into a file using the 'cPickle' module and then am retrieving it. The following is the code for it - # Code for storing the values in the file import cPickle book = {raw_input("Name: "): } file_object = file(database, 'w+') cPickle.dump(book, file_object)
1
3474
by: gaikokujinkyofusho | last post by:
Hi, I have been enjoying being able to subscribe to RSS (http://kinja.com/user/thedigestibleaggie) for awhile and have come up with a fairly nice list of feeds but I have run into an annoying (though not critical) problem, duplicate stories. Apparently there is overlap with some of the sites I subscribe to so I get duplicate stories. Does...
12
20784
by: joestevens232 | last post by:
Hello Im having problems figuring out how to remove the duplicate entries in an array...Write a program that accepts a sequence of integers (some of which may repeat) as input into an array. Write a function that processes the array so that any duplicate values are eliminated. Write an output function that prints out the values of the array....
1
2257
by: PerumalSamy | last post by:
Hi I am having table with more 13 lakhs records. I am having duplicate records in it. i need to remove that. I wrote the following query SELECT *
3
10936
by: rajeshkrsingh | last post by:
Hi friends, Step1- create table duplicate ( intId int, varName varchar(50) ) insert into duplicate(intId,varName) values(1,'rajesh') insert into duplicate(intId,varName) values(2,'raj12') insert into duplicate(intId,varName) values(1,'rajesh')
0
7918
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...
0
8206
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. ...
1
7967
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...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5713
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...
0
5392
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...
1
2353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
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...

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.