Hi,
Please refer to my docx attachment for the web page screenshot.
Our user barcode scan some material into the application.
Sometimes, due to slow server response or because the user scan the barcode too fast, it results in double entry into the textbox.
Question: Is there a control to prevent this from happening?
My initial thought is to disable the textbox from edit upon post-back, which may/not be a good/do-able idea.
Please advise.
Please refer to my docx attachment for the web page screenshot.
Our user barcode scan some material into the application.
Sometimes, due to slow server response or because the user scan the barcode too fast, it results in double entry into the textbox.
Question: Is there a control to prevent this from happening?
My initial thought is to disable the textbox from edit upon post-back, which may/not be a good/do-able idea.
Please advise.
10 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 23 Jun 2011, 02:53 PM
Hello Steven,
You can use RadnumericTextBox (RadTextBox) and achieve the desired functionality with the following client side code.
aspx:
Javascript:
Also take a look at the following demo for more on client side API.
Input / API and Events.
Thanks,
Shinu.
You can use RadnumericTextBox (RadTextBox) and achieve the desired functionality with the following client side code.
aspx:
<
telerik:RadNumericTextBox
ID
=
"RadTextBox2"
runat
=
"server"
EmptyMessage
=
"type here"
InvalidStyleDuration
=
"100"
AutoPostBack
=
"true"
>
<
ClientEvents
OnValueChanged
=
"ValueChanged"
OnBlur
=
"OnBlur"
/>
</
telerik:RadNumericTextBox
>
Javascript:
<script type=
"text/javascript"
>
var
flag = 0;
//setting a global variable
function
ValueChanged1(sender, args)
// This event fires only the value of the input changed.
{
flag = 1;
alert(args.get_oldValue());
var
old = args.get_oldValue();
var
newValue = args.get_newValue();
if
(old == newValue)
{
args.set_cancel(
true
);
alert(
"Duplicate Value!!"
);
}
}
function
OnBlur(Sender, args)
{
if
(flag == 0)
//checking whether the value has changed.
{
flag = 1;
alert(
"Value Should Be Same"
);
Sender.clear();
}
}
</script>
Also take a look at the following demo for more on client side API.
Input / API and Events.
Thanks,
Shinu.
0
STEVEN
Top achievements
Rank 1
answered on 24 Jun 2011, 04:16 AM
Hi,
I mis-worded my previous description of the issue. I should have said that,
Our user barcode scan some material into the application.
Sometimes, due to slow server response or because the user scan the barcode too fast, it results in multiple entries into the textbox.
Question: Is there a control to prevent this from happening?
My initial thought is to disable the textbox from edit upon post-back, which may/not be a good/do-able idea.
To further describe, the 1st serial no is, qwert1 and the page auto-postback. However, the server is slow and the user barcode scans the 2nd serial id, qwert2 before the postback completes. Thus the value in the textbox becomes, qwert1qwert2.
Please advise.
I mis-worded my previous description of the issue. I should have said that,
Our user barcode scan some material into the application.
Sometimes, due to slow server response or because the user scan the barcode too fast, it results in multiple entries into the textbox.
Question: Is there a control to prevent this from happening?
My initial thought is to disable the textbox from edit upon post-back, which may/not be a good/do-able idea.
To further describe, the 1st serial no is, qwert1 and the page auto-postback. However, the server is slow and the user barcode scans the 2nd serial id, qwert2 before the postback completes. Thus the value in the textbox becomes, qwert1qwert2.
Please advise.
0
Hus Damen
Top achievements
Rank 1
answered on 28 Jun 2011, 08:23 AM
Hi,
Maybe you can use ajax manager and disable the text box when the request start and re-enable it after the response is back:
http://www.telerik.com/help/aspnet-ajax/ajax-disable-controls-during-ajax.html
Thanks
Hus
Maybe you can use ajax manager and disable the text box when the request start and re-enable it after the response is back:
http://www.telerik.com/help/aspnet-ajax/ajax-disable-controls-during-ajax.html
Thanks
Hus
0
STEVEN
Top achievements
Rank 1
answered on 28 Jun 2011, 12:26 PM
Hi,
Can this be done without ajax?
Currently, it performs a full postback.
Can this be done without ajax?
Currently, it performs a full postback.
0
STEVEN
Top achievements
Rank 1
answered on 28 Jun 2011, 12:27 PM
Hi,
Can this be done without ajax?
Currently, it performs a full postback.
Can this be done without ajax?
Currently, it performs a full postback.
0
0
Hus Damen
Top achievements
Rank 1
answered on 29 Jun 2011, 12:49 PM
Hi,
Without ajax you can try this code:
Thanks
Hus
Without ajax you can try this code:
<
script
type
=
"text/javascript"
>
Sys.Application.add_load(myLoad);
function myLoad()
{
$find("<%= RTB1.ClientID %>").enable();
}
function MyBlur(sender, args)
{
sender.disable()
}
</
script
>
<
telerik:RadTextBox
runat
=
"server"
ID
=
"RTB1"
AutoPostBack
=
"true"
OnTextChanged
=
"RTB1_TextChanged"
ClientEvents-OnBlur
=
"MyBlur"
>
</
telerik:RadTextBox
>
protected void RTB1_TextChanged(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
}
Thanks
Hus
0
STEVEN
Top achievements
Rank 1
answered on 02 Jul 2011, 09:39 AM
Hi,
How can I check for the length of the text user input?
I tried to use args.get_newValue() but it throws exception.
"Microsoft JScript runtime error: Object doesn't support this property or method"
<
script
type
=
"text/javascript"
>
Sys.Application.add_load(myLoad);
function myLoad()
{
$find("<%= RTB1.ClientID %>").enable();
}
function MyBlur(sender, args)
{
// How can I check for the length of the text user input?
// Only disable if args.value.length > 0.
sender.disable()
}
</
script
>
<
telerik:RadTextBox
runat
=
"server"
ID
=
"RTB1"
AutoPostBack
=
"true"
OnTextChanged
=
"RTB1_TextChanged"
ClientEvents-OnBlur
=
"MyBlur"
>
</
telerik:RadTextBox
>
0
Hello Steven,
I would suggest that you use the get_value() method of the RadTextBox client side object:
For more information on the matter please check this help topic:
RadTextBox Client Object
I hope this helps.
Kind regards,
Martin
the Telerik team
I would suggest that you use the get_value() method of the RadTextBox client side object:
function
MyBlur(sender, args)
{
if
(sender.get_value().length > 0)
{
sender.disable();
}
}
For more information on the matter please check this help topic:
RadTextBox Client Object
I hope this helps.
Kind regards,
Martin
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
0
STEVEN
Top achievements
Rank 1
answered on 06 Jul 2011, 01:46 AM
Thanks.
That link helps a lot.
That link helps a lot.