This is a migrated thread and some comments may be shown as answers.
% character is being removed as a value in combobox
12 Answers 53 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Barry
Top achievements
Rank 1
Barry asked on 01 Feb 2011, 05:20 AM
Hello,

I have a combobox, once I enter a % character in between characters or as a last character (e.g  ba%ry or barr%) , upon debugging I am receiving an incorrect string, the % character does not anymore exist. Its seems that the combobox removes this character. But if I input it as a first character (e.g %arry) I am able to retrieve the correct string.

Please advice

12 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 01 Feb 2011, 10:23 AM
Hello Barry,

I have tried to reproduce depicted issue, but to no avail. Here is a screencast of my test. Let me know if I am missing something.

Kind regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Barry
Top achievements
Rank 1
answered on 07 Feb 2011, 12:02 PM
Hi Georgi,

Thanks for the response! What version Telerik.Web.Mvc.dll are you using? I am currently using Telerik.Web.Mvc.dll  version 2010.3.1110.235. This was downloaded before from your site. I am only using the open source codes.

0
Georgi Krustev
Telerik team
answered on 07 Feb 2011, 01:14 PM
Hello Barry,

 
I have used our live demos to test the reported issue. Currently they run under SP1 Q3 release (version 2010.3.1318). I recommend you to download it and test with it.

Best regard,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Barry
Top achievements
Rank 1
answered on 08 Feb 2011, 02:06 AM
Hi Georgi,

I downloaded the demo project that you advised me to. Using that version, I performed a simple test

1. I modified the FirstLook.aspx by adding a simple form and a submit button (this will submit the value of the combobox)

 

 

<h3>ComboBox</h3>

 

 

 

<form>

 

 

 

<input type="submit" id="submitButton" name="submitButton" value="Submit" />

 

<%

 

= Html.Telerik().ComboBox()

 

.Name(

 

"ComboBox")

 

.AutoFill(Model.ComboBoxAttributes.AutoFill.Value)

.SelectedIndex(Model.ComboBoxAttributes.SelectedIndex.Value)

.BindTo(

 

new SelectList(Model.Products, "ProductName", "ProductName"))

 

.HtmlAttributes(

 

new { style = string.Format("width:{0}px", Model.ComboBoxAttributes.Width) })

 

.Filterable(filtering =>

{

 

 

if (Model.ComboBoxAttributes.FilterMode != 0)

 

{

filtering.FilterMode(

 

AutoCompleteFilterMode.StartsWith);

 

}

})

.HighlightFirstMatch(Model.ComboBoxAttributes.HighlightFirst.Value)%>

 

 

 

</form>

 




2. Modified the FirstLookController.cs to receive the value of the combobox


 

 

public ActionResult FirstLook(ComboBoxFirstLookModel model, string ComboBox)

 

{

model.AutoCompleteAttributes.Width = model.AutoCompleteAttributes.Width ?? 200;

model.AutoCompleteAttributes.HighlightFirst = model.AutoCompleteAttributes.HighlightFirst ??

 

true;

 

model.AutoCompleteAttributes.AutoFill = model.AutoCompleteAttributes.AutoFill ??

 

false;

 

model.AutoCompleteAttributes.AllowMultipleValues = model.AutoCompleteAttributes.AllowMultipleValues ??

 

true;

 

model.AutoCompleteAttributes.MultipleSeparator = model.AutoCompleteAttributes.MultipleSeparator ??

 

", ";

 

model.ComboBoxAttributes.Width = model.ComboBoxAttributes.Width ?? 200;

model.ComboBoxAttributes.SelectedIndex = model.ComboBoxAttributes.SelectedIndex ?? 0;

model.ComboBoxAttributes.HighlightFirst = model.ComboBoxAttributes.HighlightFirst ??

 

true;

 

model.ComboBoxAttributes.AutoFill = model.ComboBoxAttributes.AutoFill ??

 

true;

 

model.DropDownListAttributes.Width = model.DropDownListAttributes.Width ?? 200;

model.DropDownListAttributes.SelectedIndex = model.DropDownListAttributes.SelectedIndex ?? 0;

 

 

var nw = new Telerik.Web.Mvc.Examples.Models.NorthwindDataContext();

 

model.Products = nw.Products.ToList();

 

 

return View(model);

 

}


3. performed a debug at the FirstLookController.cs

4. Run the program and input the value of %Chai% in the combobox.

5.Click the Submit Button

RESULTS:

 Results where the same, I only received the value of Chai (No % sign). One thing I noticed, in my querystring I have
"http://localhost:7777/combobox?submitButton=Submit&ComboBox-input=%25Chai%25&ComboBox=Chai". I noticed that there is a another control created ComboBox-input which has the correct value, though ComboBox should be my control.

Im using VS 2010 Microsoft Windows XP SP3. Please advise.

0
Barry
Top achievements
Rank 1
answered on 08 Feb 2011, 07:32 AM
Hi Georgi,

I tried looking into the telerik codes and found the problem.

In the telerik.combobox.js there is a function keypress(e).
 

 

 

function keypress(e) {

 

 

 

var key = e.keyCode || e.charCode;

 

 

 

if (key == 0 || $.inArray(key, $t.list.keycodes) != -1 || e.ctrlKey) return true;

 

 

 

 

// always set value. Select(item) will override it if needed.

 

setTimeout($.proxy(

 

function () { this.$input.val(this.$text.val()); }, this), 0);

 

resetTimer(

 

this);

 

}

Inside we update the hidden input which is the "ComboBox" with the value of the "ComboBox-input" using this line

setTimeout($.proxy(

 

function () { this.$input.val(this.$text.val()); }, this), 0);

 

the problem is that there is also this line before that

if

 

 

(key == 0 || $.inArray(key, $t.list.keycodes) != -1 || e.ctrlKey) return true;

 

Pressing shift + % passes this criteria which in effect, the code will not anymore reach the update statement.


To fix this, since I am using IE7 and the intended users are also using IE7, I just added the following: (Key 37 pertains to shift + % in IE7)


function
keypress(e) {

 

 

 

var key = e.keyCode || e.charCode;

 

 

 

if (key != 37) {

 

 

 

if (key == 0 || $.inArray(key, $t.list.keycodes) != -1 || e.ctrlKey) return true;

 

}

 

 

// always set value. Select(item) will override it if needed.

 

 

 

 

 

 

setTimeout($.proxy(

 

function () { this.$input.val(this.$text.val()); }, this), 0);

 

resetTimer(

 

this);

 

}



I performed some testings and it now works perfectly for my need.
0
Georgi Krustev
Telerik team
answered on 08 Feb 2011, 05:01 PM
Hello Barry,

 
Thank you for the posted code samples.

Nevertheless I was not able to reproduce depicted issue with version 2010.3.1318 (SP1 Q3 2010). I have created a sample project in my attempt to replicate the problem. It is attached to this message.

Please let me know if I am missing something.

Regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Barry
Top achievements
Rank 1
answered on 09 Feb 2011, 02:09 AM
Hi Georgi,

I tried the project that you provided and it did not work. What browser are you using? The issue occured due to different keystroke behaviors between browsers. As I mentioned last time, we have this line

if (key == 0 || $.inArray(key, $t.list.keycodes) != -1 || e.ctrlKey) return true;

the list of keycodes are provided in  telerik.list.js which are

  keycodes: [8, // backspace
                   9, // tab
                  13, // enter
                  27, // escape
                  37, // left arrow
                  38, // up arrow
                  39, // right arrow
                  40, // down arrow
                  35, // end
                  36, // home
                  46] // delete

Pressing shift + % is also equivalent to 37 in IE7. That is why it passes the condition   $.inArray(key, $t.list.keycodes) != -1  and in result does not anymore reaches the code

//this updates the hidden field used in the telerik combobox
function
() { this.$input.val(this.$text.val()); }, this), 0);

You can try it using IE7. I think you should be able to recreate the issue by that browser.
0
Georgi Krustev
Telerik team
answered on 09 Feb 2011, 10:22 AM
Hello Barry,

 
Thank you for the clarification.

I was able to observe the reported issue. I am glad to inform you that it was fixed.
For your convenience I have attached the modified JavaScript file.

I have updated your Telerik points.

All the best,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Barry
Top achievements
Rank 1
answered on 10 Feb 2011, 08:41 AM
Thanks Georgi! Glad to hear that telerik fixed the problem.
0
Kai-Tobias
Top achievements
Rank 1
answered on 22 Mar 2011, 03:36 PM
Hi,

I have a problem which seems to be likely to the one Barry had.
If I enter a value to the ComboBox (using IE8) which ends with a dot ("."), the dot gets removed and not posted back to the server.
For example "Mr. Prof." is posted and thus stored in the database as "Mr. Prof", which is wrong.
I am using 2011.1.315 and hoped to change my "hidden-textbox-workaround" with this release. I tried to fix it in the telerik.combobox.js with the value 46 (value for ".") for the key value in the keypress method, but it showed no effect. Maybe I am completely wrong there anyway..

Any suggestions on how to solve this ?

Best regards,
Kai
0
Hristo Germanov
Telerik team
answered on 23 Mar 2011, 05:54 PM
Hi Kai-Tobias,

Thank you for reporting this issue.

I confirm this is a bug and it will be fixed with next official release of Telerik Components for ASP.NET MVC.

For your convenience I have attached telerik.list.min.js and telerik.combobox.min.js files which include the fix.

I have updated your Telerik points.

Kind regards,
Hristo Germanov
the Telerik team
0
Kai-Tobias
Top achievements
Rank 1
answered on 31 Mar 2011, 01:49 PM
Hi Hristo,

Great, thank you very much for the quick reply!
Tags
ComboBox
Asked by
Barry
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Barry
Top achievements
Rank 1
Kai-Tobias
Top achievements
Rank 1
Hristo Germanov
Telerik team
Share this question
or