By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,561 Members | 3,010 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,561 IT Pros & Developers. It's quick & easy.

To check duplication of values in textbox placed inside datagrid

P: 5
Hi,I am New To This .
I have to check the duplications of values entered in textbox which is placed inside the datagrid.And the Number of textbox is not constant it is dynamically added can any one solve this
Jan 2 '08 #1
Share this Question
Share on Google+
5 Replies


gits
Expert Mod 5K+
P: 5,333
hi ...

please explain it in more detail. what datagrid ... no duplicate values in rows or cols? ... show the code you already have so that we have an example to work with ...

kind regards
Jan 2 '08 #2

P: 5
Hi

I am having textboxes placed inside the DataGrid which is dynamically added.

I want check duplication of values entered in the textbox using javascript.(it can be either in onchange event or onsubmit event

can anyone guide me
Jan 3 '08 #3

P: 5
hi ...

please explain it in more detail. what datagrid ... no duplicate values in rows or cols? ... show the code you already have so that we have an example to work with ...

kind regards

Hi.GOOD MORNING.

Thanks for ur response.
Consider my grid having many textbox.And the number of textbox is not always constant.Suppose if am entereing 'thescripts' in one textbox and the same also in another textbox ,it should throw error.

Kindly note the number of textbox in the grid is not constant.
I can do this in server side ,since i want to do this in Jvascript kindy help me.
Jan 3 '08 #4

gits
Expert Mod 5K+
P: 5,333
hi ...

let me give you an example:

[HTML]<html>
<head>
<script type="text/javascript">
// list of already used values
var lookup = {};

function chk_input(node) {
var val = node.value;

if (typeof lookup[val] != 'undefined') {
alert(
'you have used the value ' + val
+ ' already\nin field with id ' + lookup[val]
);
node.select();
} else {
lookup[val] = node.id;
}
}
</script>
</head>
<body>
<input type="text" id="my_val0" onchange="chk_input(this);"/>
<input type="text" id="my_val1" onchange="chk_input(this);"/>
<input type="text" id="my_val2" onchange="chk_input(this);"/>
<input type="text" id="my_val3" onchange="chk_input(this);"/>
<input type="text" id="my_val4" onchange="chk_input(this);"/>
<input type="text" id="my_val5" onchange="chk_input(this);"/>
</body>
</html>
[/HTML]
whenever you change a textbox-value it will be checked against a list of values that were already used and gives you an alert in case we find the value in the list already ...

kind regards
Jan 3 '08 #5

gits
Expert Mod 5K+
P: 5,333
threads merged ... don't double post your questions!

regards
MOD
Jan 3 '08 #6

Post your reply

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