Hi Jeremy,

I am using version 1.3.6 yes (using the DefaultCssAutocompleteTextField).
The issue you mention does not refer to IE8 and thusfar that's the only
brower the problem seems to occur in.

I put the following in the HomePage.java of my Quickstart:

---------------
public class HomePage extends WebPage {

    public HomePage(final PageParameters parameters) {
        add(new HomeForm("form"));
    }

    private static class HomeForm extends Form {
        private String test;

        public HomeForm(String id) {
            super(id);
            add(createAutoComplete());
        }

        private Component createAutoComplete() {
            IModel valueModel = new Model() {
                @Override
                public String getObject() {
                    return test;
                }

                @Override
                public void setObject(Object object) {
                    test = (String) object;
                }
            };
            return new DefaultCssAutocompleteTextField("test", valueModel) {

                @Override
                protected Iterator<String> getChoices(String input) {
                    return new ChoiceGenerator(input);
                }

            };
        }

    }

    private static class ChoiceGenerator implements Iterator<String> {
        private String base;
        private int count = 0;

        public ChoiceGenerator(String base) {
            this.base = base;
        }

        @Override
        public boolean hasNext() {
            return count < 5;
        }

        @Override
        public String next() {
            count++;
            StringBuilder buf = new StringBuilder(base);
            for (int i = 0; i < count; i++) {
                buf.append(i);
            }
            return buf.toString();
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException();
        }

    }
}

---------------

Behaviour in IE8 is as follows:
- Type 'a'
  Options appear
- Type 'b'
  Options dissappear and IE8 mentions:

Foutdetails webpagina

Gebruikersagent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1;
Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
Tijdstempel: Tue, 21 Jul 2009 12:30:49 UTC


Bericht: Ongeldig argument.(i.e. invalid argument)
Regel: 308
Teken: 9
Code: 0
URI:
http://localhost:8080/resources/org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteBehavior/wicket-autocomplete.js

I do notice that the Ajax request is received by the application and when
using the debug panel on the page i notice the correct response.

Best regards,

Wilko




jthomerson wrote:
> 
> Can you see if it's a duplicate of this:
> http://issues.apache.org/jira/browse/WICKET-1504
> 
> If so, I'm not sure why you would be experiencing it - as that issue
> says that it was fixed in 1.3.6 and you said you're using 1.3.6.  Did
> you just recently switch to 1.3.6?  If so, have you cleared your
> cache?
> 
> --
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> 
> 
> 
> On Thu, May 28, 2009 at 3:51 AM, Christian G.
> Fichera<[email protected]> wrote:
>> Dear all,
>>
>> I have a problem using AutoCompleteTextField: when I type something into
>> it,
>> the choices list is not shown, and the following javascript error is
>> thrown:
>>
>>
>> Webpage error details
>>
>> User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1;
>> Trident/4.0;
>> .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR
>> 3.0.04506.648)
>> Timestamp: Thu, 28 May 2009 08:19:40 UTC
>>
>>
>> Message: Invalid argument.
>> Line: 253
>> Char: 1
>> Code: 0
>> URI:
>> http://localhost:8080/TADinfo/analysis/resources/org.apache.wicket.extension
>> s.ajax.markup.html.autocomplete.AutoCompleteBehavior/wicket-autocomplete.js
>>
>>
>>
>>
>> This problem occurs only with IE8 (with IE7, IE6 and Firefox works), and
>> Wicket 1.3.6 (with version 1.3.4 works).
>>
>> Can anybody help me?
>>
>> Thank you in advance!
>>
>> Here is the code:
>>
>>    private class LocalitiesAutoCompleteTextField extends
>> AutoCompleteTextField{
>>
>>
>>        private int type;
>>
>>        private final static int MIN_CHAR = 0;
>>        private final static int MAX_RES = 10;
>>        private Object selectedObject;
>>
>>
>>
>>        public LocalitiesAutoCompleteTextField(String id, int type,  final
>> IModel model){
>>            super(id, model);//, new LocalityListRenderer());
>>            this.type = type;
>>
>>        }
>>
>>
>>        public Object getSelectedObject(){
>>            return selectedObject;
>>        }
>>
>>
>>       �...@override
>>        public String getModelValue(){
>>            return super.getModelValue();
>>        }
>>
>>
>>       �...@override
>>        public Iterator getChoices(String input) {
>>            if (!Strings.isEmpty(input)){
>>                List choices = new ArrayList();
>>                if (input.length() >= MIN_CHAR){
>>                    int i=0;
>>                    switch(type){
>>                        case LAYER0:
>>                            for (Layer0
>> layer0:facade.selectLayer0ByDisplayNameStartingWith(input)){
>>                                if (++i > MAX_RES){
>>                                    break;
>>                                }
>>                                choices.add(layer0);
>>                            }
>>                            for (Layer0
>> layer0:facade.selectLayer0ByDisplayNameContaining(input)){
>>                                if (++i > MAX_RES){
>>                                    break;
>>                                }
>>                                choices.add(layer0);
>>                            }
>>                            if (i>MAX_RES){
>>                                choices.add(MORE);
>>                            }
>>                            break;
>>                        case LAYER1:
>>                            for (Layer1
>> layer1:facade.selectLayer1ByDisplayNameStartingWith(input)){
>>                                if (++i > MAX_RES){
>>                                    break;
>>                                }
>>                                choices.add(layer1);
>>                            }
>>                            for (Layer1
>> layer1:facade.selectLayer1ByDisplayNameContaining(input)){
>>                                if (++i > MAX_RES){
>>                                    break;
>>                                }
>>                                choices.add(layer1);
>>                            }
>>                            if (i>MAX_RES){
>>                                choices.add(MORE);
>>                            }
>>                            break;
>>                        case LAYER2:
>>                            for (Layer2
>> layer2:facade.selectLayer2ByDisplayNameStartingWith(input)){
>>                                if (++i > MAX_RES){
>>                                    break;
>>                                }
>>                                choices.add(layer2);
>>                            }
>>                            for (Layer2
>> layer2:facade.selectLayer2ByDisplayNameContaining(input)){
>>                                if (++i > MAX_RES){
>>                                    break;
>>                                }
>>                                choices.add(layer2);
>>                            }
>>                            if (i>MAX_RES){
>>                                choices.add(MORE);
>>                            }
>>                            break;
>>                        case LOCALITY:
>>                            for (Localitydb
>> locality:facade.selectLocalityByDisplayNameStartingWith(input)){
>>                                if (++i > MAX_RES){
>>                                    break;
>>                                }
>>                                choices.add(locality);
>>                            }
>>
>>                            for (Localitydb
>> locality:facade.selectLocalityByDisplayNameContaining(input)){
>>                                if (++i > MAX_RES){
>>                                    break;
>>                                }
>>                                choices.add(locality);
>>                            }
>>                            if (i>MAX_RES){
>>                                choices.add(MORE);
>>                            }
>>                            break;
>>                    }
>>                    return choices.iterator();
>>                }
>>            }
>>            return Collections.emptyList().iterator();
>>        }
>>    }
>>
>>    class LocalityListRenderer extends AbstractAutoCompleteTextRenderer{
>>       �...@override
>>        public void renderChoice(Object object, Response response, String
>> criteria) {
>>            String string = "";
>>            if (object instanceof Localitydb){
>>                string =
>> LocalityListComponentPanel.this.getPath(((Localitydb)object));
>>            }
>>            else if (object instanceof Layer2){
>>                string =
>> LocalityListComponentPanel.this.getPath(((Layer2)object));
>>            }
>>            else if (object instanceof Layer1){
>>                string =
>> LocalityListComponentPanel.this.getPath(((Layer1)object));
>>            }
>>            else if (object instanceof Layer0){
>>                string = ((Layer0)object).getDisplayname();
>>            }
>>            else if (object instanceof String &&
>> object.toString().equals(MORE)){
>>                response.write("
>> style=\"font-style:italic;text-align:center\">" + MORE + "");
>>                return;
>>            }
>>            else{
>>                return;
>>            }
>>            if (string.contains(SEPARATOR)){
>>                int index = string.indexOf(SEPARATOR);
>>                String path = string.substring(index);
>>                String info = string.substring(0, index);
>>                StringBuffer sb = new StringBuffer();
>>                sb.append("<table width=\"95%\">");
>>                sb.append("<tr>");
>>                sb.append("<td align=\"left\">");
>>                sb.append("");
>>                sb.append(info);
>>                sb.append("");
>>                sb.append("</td>");
>>                sb.append("<td align=\"right\">");
>>                sb.append("
>> style=\"color:grey;font-style:italic;font-size:xx-small\">");
>>                sb.append(path);
>>                sb.append("");
>>                sb.append("</td>");
>>                sb.append("</tr>");
>>                sb.append("</table>");
>>                response.write(sb);
>>            }
>>            else{
>>                response.write(string);
>>            }
>>        }
>>       �...@override
>>        protected String getTextValue(Object object) {
>>            if (object instanceof Localitydb){
>>                return ((Localitydb)object).getDisplayname();
>>            }
>>            if (object instanceof Layer2){
>>                return ((Layer2)object).getDisplayname();
>>            }
>>            if (object instanceof Layer1){
>>                return ((Layer1)object).getDisplayname();
>>            }
>>            if (object instanceof Layer0){
>>                return ((Layer0)object).getDisplayname();
>>            }
>>            return "";
>>        }
>>
>>    }
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/AutoCompleteTextField-and-IE8%2C-javascript-error-thrown-tp23757807p24586875.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to