Re: [Wicket-user] getting form field value from AutoCompleteTextField
I think I found one solution, what I did was to add the normal textfield an AjaxFormComponentUpdatingBehavior associated to the onchange event. In the code of onUpdate() I add an AttributeModifier that replaces the value of the value attribute, then I replace the textfield in the form and use target.addComponent(form, form) to replace the form in the page, so when the autocomplete textfield receives input the getElementById() can get the value. At least is working, any comments are welcome. Jaime. Jaime De La Jara [EMAIL PROTECTED] wrote: I'm not sure if I fully understand it, but maybe if the first textfield sent its value and a serverside reference hold it until the autocomplete field received the input and used this value?. Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: hmmm it doesnt work because the url is cached by the autocomplete script. we need to think of another way. -igor On 3/27/07, Jaime De La Jara [EMAIL PROTECTED] wrote:Ok, I understand, now I'm including a striped down code version of the problem. It contains an ant build file whose directory definition should be changed, but apart from that I think it could run without trouble, I haven't included style file so the autocomplete box is transparent but it's working. If you take a look at the VendorsAutocompleteBehaviour.java file, you'll see how the parameter is being recovered using document.getElementById. Thanks, Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: the reason i wanted a quickstart is so that i can see the problem in runtime. what you have sent over does not compile when i drop it into quickstart as it contains your app-specific classes/daos/validators which you have not included. -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Ok, here it goes, though it's not complete quickstart, maybe it can help to show the context. The zip contains the page ( index.html, Index.java) and the autocomplete field and behaviour. Hope it can help to find what's going on. Thanks again, Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: if you feel like creating a quickstart i can take a look at that -igor On 3/26/07, Jaime De La Jara[EMAIL PROTECTED] wrote:No, it has one (returned by getMarkupId() and generated by setOutputMarkup(true)). This is the generated html : input value= maxlength=16 type=text class=tipo size=12 name=numero id=numero script document.getElementById('numero').focus();/script The strange thing is that if I set the value of the field in the model so the page loads with the normal field populated, then the code works returning the value I set in the page (in Java). It seems that the javascript is not getting the input typed in the field. Igor Vaynberg [EMAIL PROTECTED] wrote: your textfield doesnt have an id attribute defined, so docuement.getelemetnbyid is not finding it -igor On 3/26/07, Jaime De La Jara[EMAIL PROTECTED] wrote: Sorry in the last post I had a type instead of limiter=1415 it should be numFact=1415, I'm using numFact as the request variable. Jaime De La Jara [EMAIL PROTECTED] wrote: Igor, unfortunely I haven't been able to use the solution proposed. I copied and pasted the code for the getCallbackUrl method but it had a minor typo, but after I corrected and reloaded the page with the autocomplete field the browser (IE) throws a javascript error. The following works (using a hard code value) : return super.getCallbackUrl () + limiter=1415; but If I use this : return super.getCallbackUrl () + ' + 'numeroFact=' + document.getElementById('numero').value + '; or return super.getCallbackUrl() + numeroFact=' + document.getElementById(\numero\).value + '; I get an when getting the parameter from the request. The code generated in the page is the following : new Wicket.AutoComplete('indexForm_proveedores', '/adm-facturas/app?wicket:interface=:4:indexForm:proveedores:-1:IUnversionedBehaviorListenerwicket:behaviorId=1wicket:ignoreIfNotActive=truelimiter=' + document.getElementById('numero').value + ''); It seems the retrieval of the field is returning null !. The field is defined as follows in the page : input wicket:id=numero type=text class=tipo size=12 and in the Java code : add(new TextField(numero) { public String getMarkupId() { return numero; } }.add(new NumeroFacturaValidador()). add(StringValidator.maximumLength(12)). setOutputMarkupId(true).add(new FieldFocusBehavior())); I don't know what I'm doing wrong, any help would be greatly appreciated. Jaime. Jaime De La Jara [EMAIL PROTECTED] wrote: Absolutely !, thanks a lot Igor, I'll try it right now. I agree that is an uncommon use case and it doesn't deserve an api change and a custom solution is
Re: [Wicket-user] getting form field value from AutoCompleteTextField
hmmm it doesnt work because the url is cached by the autocomplete script. we need to think of another way. -igor On 3/27/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Ok, I understand, now I'm including a striped down code version of the problem. It contains an ant build file whose directory definition should be changed, but apart from that I think it could run without trouble, I haven't included style file so the autocomplete box is transparent but it's working. If you take a look at the VendorsAutocompleteBehaviour.java file, you'll see how the parameter is being recovered using document.getElementById. Thanks, Jaime. *Igor Vaynberg [EMAIL PROTECTED]* wrote: the reason i wanted a quickstart is so that i can see the problem in runtime. what you have sent over does not compile when i drop it into quickstart as it contains your app-specific classes/daos/validators which you have not included. -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Ok, here it goes, though it's not complete quickstart, maybe it can help to show the context. The zip contains the page (index.html, Index.java) and the autocomplete field and behaviour. Hope it can help to find what's going on. Thanks again, Jaime. *Igor Vaynberg [EMAIL PROTECTED]* wrote: if you feel like creating a quickstart i can take a look at that -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: No, it has one (returned by getMarkupId() and generated by setOutputMarkup(true)). This is the generated html : input value= maxlength=16 type=text class=tipo size=12 name=numero id=numero script document.getElementById('numero').focus();/script The strange thing is that if I set the value of the field in the model so the page loads with the normal field populated, then the code works returning the value I set in the page (in Java). It seems that the javascript is not getting the input typed in the field. *Igor Vaynberg [EMAIL PROTECTED]* wrote: your textfield doesnt have an id attribute defined, so docuement.getelemetnbyid is not finding it -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Sorry in the last post I had a type instead of limiter=1415 it should be numFact=1415, I'm using numFact as the request variable. *Jaime De La Jara [EMAIL PROTECTED] * wrote: Igor, unfortunely I haven't been able to use the solution proposed. I copied and pasted the code for the getCallbackUrl method but it had a minor typo, but after I corrected and reloaded the page with the autocomplete field the browser (IE) throws a javascript error. The following works (using a hard code value) : return super.getCallbackUrl () + limiter=1415; but If I use this : return super.getCallbackUrl () + ' + 'numeroFact=' + document.getElementById('numero').value + '; or return super.getCallbackUrl() + numeroFact=' + document.getElementById(\numero\).value + '; I get an when getting the parameter from the request. The code generated in the page is the following : new Wicket.AutoComplete('indexForm_proveedores', '/adm-facturas/app?wicket:interface=:4:indexForm:proveedores:-1:IUnversionedBehaviorListenerwicket:behaviorId=1wicket:ignoreIfNotActive=truelimiter=' + document.getElementById('numero').value + ''); It seems the retrieval of the field is returning null !. The field is defined as follows in the page : input wicket:id=numero type=text class=tipo size=12 and in the Java code : add(new TextField(numero) { public String getMarkupId() { return numero; } }.add(new NumeroFacturaValidador()). add(StringValidator.maximumLength(12)). setOutputMarkupId(true).add(new FieldFocusBehavior())); I don't know what I'm doing wrong, any help would be greatly appreciated. Jaime. * Jaime De La Jara [EMAIL PROTECTED]* wrote: Absolutely !, thanks a lot Igor, I'll try it right now. I agree that is an uncommon use case and it doesn't deserve an api change and a custom solution is what is needed. Jaime. *Igor Vaynberg [EMAIL PROTECTED]* wrote: ok, this is a bit tricky but is def doable. i dont think this is a very common usecase, so i dont think we will create all the factories/etc for you to be able to do this out of the box because in most cases it will just be api bloat. that said, although not trivial it is still def very possible start with extending the autocompletebehavior override getcallbackurl and do something like return super.getcallbackurl()++'limiter='+document.getelementbyid('someid').value); so now whenever the url is invoked for the autocomplete
Re: [Wicket-user] getting form field value from AutoCompleteTextField
I'm not sure if I fully understand it, but maybe if the first textfield sent its value and a serverside reference hold it until the autocomplete field received the input and used this value?. Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: hmmm it doesnt work because the url is cached by the autocomplete script. we need to think of another way. -igor On 3/27/07, Jaime De La Jara [EMAIL PROTECTED] wrote:Ok, I understand, now I'm including a striped down code version of the problem. It contains an ant build file whose directory definition should be changed, but apart from that I think it could run without trouble, I haven't included style file so the autocomplete box is transparent but it's working. If you take a look at the VendorsAutocompleteBehaviour.java file, you'll see how the parameter is being recovered using document.getElementById. Thanks, Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: the reason i wanted a quickstart is so that i can see the problem in runtime. what you have sent over does not compile when i drop it into quickstart as it contains your app-specific classes/daos/validators which you have not included. -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Ok, here it goes, though it's not complete quickstart, maybe it can help to show the context. The zip contains the page ( index.html, Index.java) and the autocomplete field and behaviour. Hope it can help to find what's going on. Thanks again, Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: if you feel like creating a quickstart i can take a look at that -igor On 3/26/07, Jaime De La Jara[EMAIL PROTECTED] wrote:No, it has one (returned by getMarkupId() and generated by setOutputMarkup(true)). This is the generated html : input value= maxlength=16 type=text class=tipo size=12 name=numero id=numero script document.getElementById('numero').focus();/script The strange thing is that if I set the value of the field in the model so the page loads with the normal field populated, then the code works returning the value I set in the page (in Java). It seems that the javascript is not getting the input typed in the field. Igor Vaynberg [EMAIL PROTECTED] wrote: your textfield doesnt have an id attribute defined, so docuement.getelemetnbyid is not finding it -igor On 3/26/07, Jaime De La Jara[EMAIL PROTECTED] wrote: Sorry in the last post I had a type instead of limiter=1415 it should be numFact=1415, I'm using numFact as the request variable. Jaime De La Jara [EMAIL PROTECTED] wrote: Igor, unfortunely I haven't been able to use the solution proposed. I copied and pasted the code for the getCallbackUrl method but it had a minor typo, but after I corrected and reloaded the page with the autocomplete field the browser (IE) throws a javascript error. The following works (using a hard code value) : return super.getCallbackUrl () + limiter=1415; but If I use this : return super.getCallbackUrl () + ' + 'numeroFact=' + document.getElementById('numero').value + '; or return super.getCallbackUrl() + numeroFact=' + document.getElementById(\numero\).value + '; I get an when getting the parameter from the request. The code generated in the page is the following : new Wicket.AutoComplete('indexForm_proveedores', '/adm-facturas/app?wicket:interface=:4:indexForm:proveedores:-1:IUnversionedBehaviorListenerwicket:behaviorId=1wicket:ignoreIfNotActive=truelimiter=' + document.getElementById('numero').value + ''); It seems the retrieval of the field is returning null !. The field is defined as follows in the page : input wicket:id=numero type=text class=tipo size=12 and in the Java code : add(new TextField(numero) { public String getMarkupId() { return numero; } }.add(new NumeroFacturaValidador()). add(StringValidator.maximumLength(12)). setOutputMarkupId(true).add(new FieldFocusBehavior())); I don't know what I'm doing wrong, any help would be greatly appreciated. Jaime. Jaime De La Jara [EMAIL PROTECTED] wrote: Absolutely !, thanks a lot Igor, I'll try it right now. I agree that is an uncommon use case and it doesn't deserve an api change and a custom solution is what is needed. Jaime. Igor Vaynberg[EMAIL PROTECTED] wrote: ok, this is a bit tricky but is def doable. i dont think this is a very common usecase, so i dont think we will create all the factories/etc for you to be able to do this out of the box because in most cases it will just be api bloat. that said, although not trivial it is still def very possible start with extending the autocompletebehavior override getcallbackurl and do something like return super.getcallbackurl()++'limiter='+document.getelementbyid('someid').value);
Re: [Wicket-user] getting form field value from AutoCompleteTextField
On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Hi, I have a form with some fields and a AutoCompleteTextField that is working nice, however now I need to retrieve the value of a TextField from this AutoCompleteTextField so I can restrict the values shown for autocompletion. Is this possible? umm...isnt that what the autocomplete is for? you are in control of the choices, so why would you need to further restrict them? -igor in the affirmative case, could you give me a hint? Thanks, Jaime. -- Don't be flakey. Get Yahoo! Mail for Mobilehttp://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/mailand always stay connectedhttp://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/mailto friends. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] getting form field value from AutoCompleteTextField
Basically what I need is to narrow the possible choices of the autocomplete field, depending on the value the user entered in the other field (which is a normal field). This is a user requirement to simplify their data entry, in this case the normal field is an invoice number and the autocomplete field corresponds to the vendor name, so if the user enters invoice number 0189, and in the autocomplete he types E the list displayed should show only the vendors whose name start with an E and have an invoice numbered 0189. Thanks, Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Hi, I have a form with some fields and a AutoCompleteTextField that is working nice, however now I need to retrieve the value of a TextField from this AutoCompleteTextField so I can restrict the values shown for autocompletion. Is this possible? umm...isnt that what the autocomplete is for? you are in control of the choices, so why would you need to further restrict them? -igor in the affirmative case, could you give me a hint? Thanks, Jaime. - Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends.- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] getting form field value from AutoCompleteTextField
ok, this is a bit tricky but is def doable. i dont think this is a very common usecase, so i dont think we will create all the factories/etc for you to be able to do this out of the box because in most cases it will just be api bloat. that said, although not trivial it is still def very possible start with extending the autocompletebehavior override getcallbackurl and do something like return super.getcallbackurl ()++'limiter='+document.getelementbyid('someid').value); so now whenever the url is invoked for the autocomplete it will also contain a limiter param whose value will be the value of that textfield - make sure someid is the id of that textfield. then simply create your own component, or add the behavior directly to a textfield, see AutoCompleteTextField source - its rather trivial. now in your getchoices() you can do getrequest().getparameter(limiter) and that will give you that extra value you need to filter make sense? -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Basically what I need is to narrow the possible choices of the autocomplete field, depending on the value the user entered in the other field (which is a normal field). This is a user requirement to simplify their data entry, in this case the normal field is an invoice number and the autocomplete field corresponds to the vendor name, so if the user enters invoice number 0189, and in the autocomplete he types E the list displayed should show only the vendors whose name start with an E and have an invoice numbered 0189. Thanks, Jaime. *Igor Vaynberg [EMAIL PROTECTED]* wrote: On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Hi, I have a form with some fields and a AutoCompleteTextField that is working nice, however now I need to retrieve the value of a TextField from this AutoCompleteTextField so I can restrict the values shown for autocompletion. Is this possible? umm...isnt that what the autocomplete is for? you are in control of the choices, so why would you need to further restrict them? -igor in the affirmative case, could you give me a hint? Thanks, Jaime. -- Don't be flakey. Get Yahoo! Mail for Mobilehttp://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/mailand always stay connectedhttp://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/mailto friends. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Don't be flakey. Get Yahoo! Mail for Mobilehttp://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/mailand always stay connectedhttp://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/mailto friends. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] getting form field value from AutoCompleteTextField
Absolutely !, thanks a lot Igor, I'll try it right now. I agree that is an uncommon use case and it doesn't deserve an api change and a custom solution is what is needed. Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: ok, this is a bit tricky but is def doable. i dont think this is a very common usecase, so i dont think we will create all the factories/etc for you to be able to do this out of the box because in most cases it will just be api bloat. that said, although not trivial it is still def very possible start with extending the autocompletebehavior override getcallbackurl and do something like return super.getcallbackurl()++'limiter='+document.getelementbyid('someid').value); so now whenever the url is invoked for the autocomplete it will also contain a limiter param whose value will be the value of that textfield - make sure someid is the id of that textfield. then simply create your own component, or add the behavior directly to a textfield, see AutoCompleteTextField source - its rather trivial. now in your getchoices() you can do getrequest().getparameter(limiter) and that will give you that extra value you need to filter make sense? -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Basically what I need is to narrow the possible choices of the autocomplete field, depending on the value the user entered in the other field (which is a normal field). This is a user requirement to simplify their data entry, in this case the normal field is an invoice number and the autocomplete field corresponds to the vendor name, so if the user enters invoice number 0189, and in the autocomplete he types E the list displayed should show only the vendors whose name start with an E and have an invoice numbered 0189. Thanks, Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Hi, I have a form with some fields and a AutoCompleteTextField that is working nice, however now I need to retrieve the value of a TextField from this AutoCompleteTextField so I can restrict the values shown for autocompletion. Is this possible? umm...isnt that what the autocomplete is for? you are in control of the choices, so why would you need to further restrict them? -igor in the affirmative case, could you give me a hint? Thanks, Jaime. - Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Looking for earth-friendly autos? Browse Top Cars by Green Rating at Yahoo! Autos' Green Center. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share
Re: [Wicket-user] getting form field value from AutoCompleteTextField
Igor, unfortunely I haven't been able to use the solution proposed. I copied and pasted the code for the getCallbackUrl method but it had a minor typo, but after I corrected and reloaded the page with the autocomplete field the browser (IE) throws a javascript error. The following works (using a hard code value) : return super.getCallbackUrl() + limiter=1415; but If I use this : return super.getCallbackUrl() + ' + 'numeroFact=' + document.getElementById('numero').value + '; or return super.getCallbackUrl() + numeroFact=' + document.getElementById(\numero\).value + '; I get an when getting the parameter from the request. The code generated in the page is the following : new Wicket.AutoComplete('indexForm_proveedores', '/adm-facturas/app?wicket:interface=:4:indexForm:proveedores:-1:IUnversionedBehaviorListenerwicket:behaviorId=1wicket:ignoreIfNotActive=truelimiter=' + document.getElementById('numero').value + ''); It seems the retrieval of the field is returning null !. The field is defined as follows in the page : input wicket:id=numero type=text class=tipo size=12 and in the Java code : add(new TextField(numero) { public String getMarkupId() { return numero; } }.add(new NumeroFacturaValidador()). add(StringValidator.maximumLength(12)). setOutputMarkupId(true).add(new FieldFocusBehavior())); I don't know what I'm doing wrong, any help would be greatly appreciated. Jaime. Jaime De La Jara [EMAIL PROTECTED] wrote: Absolutely !, thanks a lot Igor, I'll try it right now. I agree that is an uncommon use case and it doesn't deserve an api change and a custom solution is what is needed. Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: ok, this is a bit tricky but is def doable. i dont think this is a very common usecase, so i dont think we will create all the factories/etc for you to be able to do this out of the box because in most cases it will just be api bloat. that said, although not trivial it is still def very possible start with extending the autocompletebehavior override getcallbackurl and do something like return super.getcallbackurl()++'limiter='+document.getelementbyid('someid').value); so now whenever the url is invoked for the autocomplete it will also contain a limiter param whose value will be the value of that textfield - make sure someid is the id of that textfield. then simply create your own component, or add the behavior directly to a textfield, see AutoCompleteTextField source - its rather trivial. now in your getchoices() you can do getrequest().getparameter(limiter) and that will give you that extra value you need to filter make sense? -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Basically what I need is to narrow the possible choices of the autocomplete field, depending on the value the user entered in the other field (which is a normal field). This is a user requirement to simplify their data entry, in this case the normal field is an invoice number and the autocomplete field corresponds to the vendor name, so if the user enters invoice number 0189, and in the autocomplete he types E the list displayed should show only the vendors whose name start with an E and have an invoice numbered 0189. Thanks, Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Hi, I have a form with some fields and a AutoCompleteTextField that is working nice, however now I need to retrieve the value of a TextField from this AutoCompleteTextField so I can restrict the values shown for autocompletion. Is this possible? umm...isnt that what the autocomplete is for? you are in control of the choices, so why would you need to further restrict them? -igor in the affirmative case, could you give me a hint? Thanks, Jaime. - Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash
Re: [Wicket-user] getting form field value from AutoCompleteTextField
Sorry in the last post I had a type instead of limiter=1415 it should be numFact=1415, I'm using numFact as the request variable. Jaime De La Jara [EMAIL PROTECTED] wrote: Igor, unfortunely I haven't been able to use the solution proposed. I copied and pasted the code for the getCallbackUrl method but it had a minor typo, but after I corrected and reloaded the page with the autocomplete field the browser (IE) throws a javascript error. The following works (using a hard code value) : return super.getCallbackUrl() + limiter=1415; but If I use this : return super.getCallbackUrl() + ' + 'numeroFact=' + document.getElementById('numero').value + '; or return super.getCallbackUrl() + numeroFact=' + document.getElementById(\numero\).value + '; I get an when getting the parameter from the request. The code generated in the page is the following : new Wicket.AutoComplete('indexForm_proveedores', '/adm-facturas/app?wicket:interface=:4:indexForm:proveedores:-1:IUnversionedBehaviorListenerwicket:behaviorId=1wicket:ignoreIfNotActive=truelimiter=' + document.getElementById('numero').value + ''); It seems the retrieval of the field is returning null !. The field is defined as follows in the page : input wicket:id=numero type=text class=tipo size=12 and in the Java code : add(new TextField(numero) { public String getMarkupId() { return numero; } }.add(new NumeroFacturaValidador()). add(StringValidator.maximumLength(12)). setOutputMarkupId(true).add(new FieldFocusBehavior())); I don't know what I'm doing wrong, any help would be greatly appreciated. Jaime. Jaime De La Jara [EMAIL PROTECTED] wrote: Absolutely !, thanks a lot Igor, I'll try it right now. I agree that is an uncommon use case and it doesn't deserve an api change and a custom solution is what is needed. Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: ok, this is a bit tricky but is def doable. i dont think this is a very common usecase, so i dont think we will create all the factories/etc for you to be able to do this out of the box because in most cases it will just be api bloat. that said, although not trivial it is still def very possible start with extending the autocompletebehavior override getcallbackurl and do something like return super.getcallbackurl()++'limiter='+document.getelementbyid('someid').value); so now whenever the url is invoked for the autocomplete it will also contain a limiter param whose value will be the value of that textfield - make sure someid is the id of that textfield. then simply create your own component, or add the behavior directly to a textfield, see AutoCompleteTextField source - its rather trivial. now in your getchoices() you can do getrequest().getparameter(limiter) and that will give you that extra value you need to filter make sense? -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Basically what I need is to narrow the possible choices of the autocomplete field, depending on the value the user entered in the other field (which is a normal field). This is a user requirement to simplify their data entry, in this case the normal field is an invoice number and the autocomplete field corresponds to the vendor name, so if the user enters invoice number 0189, and in the autocomplete he types E the list displayed should show only the vendors whose name start with an E and have an invoice numbered 0189. Thanks, Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Hi, I have a form with some fields and a AutoCompleteTextField that is working nice, however now I need to retrieve the value of a TextField from this AutoCompleteTextField so I can restrict the values shown for autocompletion. Is this possible? umm...isnt that what the autocomplete is for? you are in control of the choices, so why would you need to further restrict them? -igor in the affirmative case, could you give me a hint? Thanks, Jaime. - Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and
Re: [Wicket-user] getting form field value from AutoCompleteTextField
your textfield doesnt have an id attribute defined, so docuement.getelemetnbyid is not finding it -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Sorry in the last post I had a type instead of limiter=1415 it should be numFact=1415, I'm using numFact as the request variable. *Jaime De La Jara [EMAIL PROTECTED]* wrote: Igor, unfortunely I haven't been able to use the solution proposed. I copied and pasted the code for the getCallbackUrl method but it had a minor typo, but after I corrected and reloaded the page with the autocomplete field the browser (IE) throws a javascript error. The following works (using a hard code value) : return super.getCallbackUrl() + limiter=1415; but If I use this : return super.getCallbackUrl() + ' + 'numeroFact=' + document.getElementById('numero').value + '; or return super.getCallbackUrl() + numeroFact=' + document.getElementById(\numero\).value + '; I get an when getting the parameter from the request. The code generated in the page is the following : new Wicket.AutoComplete('indexForm_proveedores', '/adm-facturas/app?wicket:interface=:4:indexForm:proveedores:-1:IUnversionedBehaviorListenerwicket:behaviorId=1wicket:ignoreIfNotActive=truelimiter=' + document.getElementById('numero').value + ''); It seems the retrieval of the field is returning null !. The field is defined as follows in the page : input wicket:id=numero type=text class=tipo size=12 and in the Java code : add(new TextField(numero) { public String getMarkupId() { return numero; } }.add(new NumeroFacturaValidador()). add(StringValidator.maximumLength(12)). setOutputMarkupId(true).add(new FieldFocusBehavior())); I don't know what I'm doing wrong, any help would be greatly appreciated. Jaime. *Jaime De La Jara [EMAIL PROTECTED]* wrote: Absolutely !, thanks a lot Igor, I'll try it right now. I agree that is an uncommon use case and it doesn't deserve an api change and a custom solution is what is needed. Jaime. *Igor Vaynberg [EMAIL PROTECTED]* wrote: ok, this is a bit tricky but is def doable. i dont think this is a very common usecase, so i dont think we will create all the factories/etc for you to be able to do this out of the box because in most cases it will just be api bloat. that said, although not trivial it is still def very possible start with extending the autocompletebehavior override getcallbackurl and do something like return super.getcallbackurl()++'limiter='+document.getelementbyid('someid').value); so now whenever the url is invoked for the autocomplete it will also contain a limiter param whose value will be the value of that textfield - make sure someid is the id of that textfield. then simply create your own component, or add the behavior directly to a textfield, see AutoCompleteTextField source - its rather trivial. now in your getchoices() you can do getrequest().getparameter(limiter) and that will give you that extra value you need to filter make sense? -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Basically what I need is to narrow the possible choices of the autocomplete field, depending on the value the user entered in the other field (which is a normal field). This is a user requirement to simplify their data entry, in this case the normal field is an invoice number and the autocomplete field corresponds to the vendor name, so if the user enters invoice number 0189, and in the autocomplete he types E the list displayed should show only the vendors whose name start with an E and have an invoice numbered 0189. Thanks, Jaime. *Igor Vaynberg [EMAIL PROTECTED]* wrote: On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Hi, I have a form with some fields and a AutoCompleteTextField that is working nice, however now I need to retrieve the value of a TextField from this AutoCompleteTextField so I can restrict the values shown for autocompletion. Is this possible? umm...isnt that what the autocomplete is for? you are in control of the choices, so why would you need to further restrict them? -igor in the affirmative case, could you give me a hint? Thanks, Jaime. -- Don't be flakey. Get Yahoo! Mail for Mobilehttp://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/mailand always stay connectedhttp://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/mailto friends. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___
Re: [Wicket-user] getting form field value from AutoCompleteTextField
No, it has one (returned by getMarkupId() and generated by setOutputMarkup(true)). This is the generated html : input value= maxlength=16 type=text class=tipo size=12 name=numero id=numero scriptdocument.getElementById('numero').focus();/script The strange thing is that if I set the value of the field in the model so the page loads with the normal field populated, then the code works returning the value I set in the page (in Java). It seems that the javascript is not getting the input typed in the field. Igor Vaynberg [EMAIL PROTECTED] wrote: your textfield doesnt have an id attribute defined, so docuement.getelemetnbyid is not finding it -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote:Sorry in the last post I had a type instead of limiter=1415 it should be numFact=1415, I'm using numFact as the request variable. Jaime De La Jara [EMAIL PROTECTED] wrote: Igor, unfortunely I haven't been able to use the solution proposed. I copied and pasted the code for the getCallbackUrl method but it had a minor typo, but after I corrected and reloaded the page with the autocomplete field the browser (IE) throws a javascript error. The following works (using a hard code value) : return super.getCallbackUrl() + limiter=1415; but If I use this : return super.getCallbackUrl() + ' + 'numeroFact=' + document.getElementById('numero').value + '; or return super.getCallbackUrl() + numeroFact=' + document.getElementById(\numero\).value + '; I get an when getting the parameter from the request. The code generated in the page is the following : new Wicket.AutoComplete('indexForm_proveedores', '/adm-facturas/app?wicket:interface=:4:indexForm:proveedores:-1:IUnversionedBehaviorListenerwicket:behaviorId=1wicket:ignoreIfNotActive=truelimiter=' + document.getElementById('numero').value + ''); It seems the retrieval of the field is returning null !. The field is defined as follows in the page : input wicket:id=numero type=text class=tipo size=12 and in the Java code : add(new TextField(numero) { public String getMarkupId() { return numero; } }.add(new NumeroFacturaValidador()). add(StringValidator.maximumLength(12)). setOutputMarkupId(true).add(new FieldFocusBehavior())); I don't know what I'm doing wrong, any help would be greatly appreciated. Jaime. Jaime De La Jara [EMAIL PROTECTED] wrote: Absolutely !, thanks a lot Igor, I'll try it right now. I agree that is an uncommon use case and it doesn't deserve an api change and a custom solution is what is needed. Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: ok, this is a bit tricky but is def doable. i dont think this is a very common usecase, so i dont think we will create all the factories/etc for you to be able to do this out of the box because in most cases it will just be api bloat. that said, although not trivial it is still def very possible start with extending the autocompletebehavior override getcallbackurl and do something like return super.getcallbackurl()++'limiter='+document.getelementbyid('someid').value); so now whenever the url is invoked for the autocomplete it will also contain a limiter param whose value will be the value of that textfield - make sure someid is the id of that textfield. then simply create your own component, or add the behavior directly to a textfield, see AutoCompleteTextField source - its rather trivial. now in your getchoices() you can do getrequest().getparameter(limiter) and that will give you that extra value you need to filter make sense? -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Basically what I need is to narrow the possible choices of the autocomplete field, depending on the value the user entered in the other field (which is a normal field). This is a user requirement to simplify their data entry, in this case the normal field is an invoice number and the autocomplete field corresponds to the vendor name, so if the user enters invoice number 0189, and in the autocomplete he types E the list displayed should show only the vendors whose name start with an E and have an invoice numbered 0189. Thanks, Jaime. Igor Vaynberg [EMAIL PROTECTED] wrote: On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Hi, I have a form with some fields and a AutoCompleteTextField that is working nice, however now I need to retrieve the value of a TextField from this AutoCompleteTextField so I can restrict the values shown for autocompletion. Is this possible? umm...isnt that what the autocomplete is for? you are in control of the choices, so why would you need to further restrict them? -igor in the affirmative case, could you give me a hint? Thanks, Jaime. - Don't be flakey.
Re: [Wicket-user] getting form field value from AutoCompleteTextField
if you feel like creating a quickstart i can take a look at that -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: No, it has one (returned by getMarkupId() and generated by setOutputMarkup(true)). This is the generated html : input value= maxlength=16 type=text class=tipo size=12 name=numero id=numero scriptdocument.getElementById('numero').focus();/script The strange thing is that if I set the value of the field in the model so the page loads with the normal field populated, then the code works returning the value I set in the page (in Java). It seems that the javascript is not getting the input typed in the field. *Igor Vaynberg [EMAIL PROTECTED]* wrote: your textfield doesnt have an id attribute defined, so docuement.getelemetnbyid is not finding it -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Sorry in the last post I had a type instead of limiter=1415 it should be numFact=1415, I'm using numFact as the request variable. *Jaime De La Jara [EMAIL PROTECTED] * wrote: Igor, unfortunely I haven't been able to use the solution proposed. I copied and pasted the code for the getCallbackUrl method but it had a minor typo, but after I corrected and reloaded the page with the autocomplete field the browser (IE) throws a javascript error. The following works (using a hard code value) : return super.getCallbackUrl() + limiter=1415; but If I use this : return super.getCallbackUrl() + ' + 'numeroFact=' + document.getElementById('numero').value + '; or return super.getCallbackUrl() + numeroFact=' + document.getElementById(\numero\).value + '; I get an when getting the parameter from the request. The code generated in the page is the following : new Wicket.AutoComplete('indexForm_proveedores', '/adm-facturas/app?wicket:interface=:4:indexForm:proveedores:-1:IUnversionedBehaviorListenerwicket:behaviorId=1wicket:ignoreIfNotActive=truelimiter=' + document.getElementById('numero').value + ''); It seems the retrieval of the field is returning null !. The field is defined as follows in the page : input wicket:id=numero type=text class=tipo size=12 and in the Java code : add(new TextField(numero) { public String getMarkupId() { return numero; } }.add(new NumeroFacturaValidador()). add(StringValidator.maximumLength(12)). setOutputMarkupId(true).add(new FieldFocusBehavior())); I don't know what I'm doing wrong, any help would be greatly appreciated. Jaime. * Jaime De La Jara [EMAIL PROTECTED]* wrote: Absolutely !, thanks a lot Igor, I'll try it right now. I agree that is an uncommon use case and it doesn't deserve an api change and a custom solution is what is needed. Jaime. *Igor Vaynberg [EMAIL PROTECTED]* wrote: ok, this is a bit tricky but is def doable. i dont think this is a very common usecase, so i dont think we will create all the factories/etc for you to be able to do this out of the box because in most cases it will just be api bloat. that said, although not trivial it is still def very possible start with extending the autocompletebehavior override getcallbackurl and do something like return super.getcallbackurl()++'limiter='+document.getelementbyid('someid').value); so now whenever the url is invoked for the autocomplete it will also contain a limiter param whose value will be the value of that textfield - make sure someid is the id of that textfield. then simply create your own component, or add the behavior directly to a textfield, see AutoCompleteTextField source - its rather trivial. now in your getchoices() you can do getrequest().getparameter(limiter) and that will give you that extra value you need to filter make sense? -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Basically what I need is to narrow the possible choices of the autocomplete field, depending on the value the user entered in the other field (which is a normal field). This is a user requirement to simplify their data entry, in this case the normal field is an invoice number and the autocomplete field corresponds to the vendor name, so if the user enters invoice number 0189, and in the autocomplete he types E the list displayed should show only the vendors whose name start with an E and have an invoice numbered 0189. Thanks, Jaime. *Igor Vaynberg [EMAIL PROTECTED]* wrote: On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Hi, I have a form with some fields and a AutoCompleteTextField that is working nice, however now I need to retrieve the value of a TextField from this AutoCompleteTextField so I can restrict the values shown for autocompletion. Is this possible? umm...isnt that what the autocomplete is for? you are in control of the choices, so
Re: [Wicket-user] getting form field value from AutoCompleteTextField
the reason i wanted a quickstart is so that i can see the problem in runtime. what you have sent over does not compile when i drop it into quickstart as it contains your app-specific classes/daos/validators which you have not included. -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Ok, here it goes, though it's not complete quickstart, maybe it can help to show the context. The zip contains the page (index.html, Index.java) and the autocomplete field and behaviour. Hope it can help to find what's going on. Thanks again, Jaime. *Igor Vaynberg [EMAIL PROTECTED]* wrote: if you feel like creating a quickstart i can take a look at that -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: No, it has one (returned by getMarkupId() and generated by setOutputMarkup(true)). This is the generated html : input value= maxlength=16 type=text class=tipo size=12 name=numero id=numero script document.getElementById('numero').focus();/script The strange thing is that if I set the value of the field in the model so the page loads with the normal field populated, then the code works returning the value I set in the page (in Java). It seems that the javascript is not getting the input typed in the field. *Igor Vaynberg [EMAIL PROTECTED]* wrote: your textfield doesnt have an id attribute defined, so docuement.getelemetnbyid is not finding it -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Sorry in the last post I had a type instead of limiter=1415 it should be numFact=1415, I'm using numFact as the request variable. *Jaime De La Jara [EMAIL PROTECTED] * wrote: Igor, unfortunely I haven't been able to use the solution proposed. I copied and pasted the code for the getCallbackUrl method but it had a minor typo, but after I corrected and reloaded the page with the autocomplete field the browser (IE) throws a javascript error. The following works (using a hard code value) : return super.getCallbackUrl() + limiter=1415; but If I use this : return super.getCallbackUrl () + ' + 'numeroFact=' + document.getElementById('numero').value + '; or return super.getCallbackUrl() + numeroFact=' + document.getElementById(\numero\).value + '; I get an when getting the parameter from the request. The code generated in the page is the following : new Wicket.AutoComplete('indexForm_proveedores', '/adm-facturas/app?wicket:interface=:4:indexForm:proveedores:-1:IUnversionedBehaviorListenerwicket:behaviorId=1wicket:ignoreIfNotActive=truelimiter=' + document.getElementById('numero').value + ''); It seems the retrieval of the field is returning null !. The field is defined as follows in the page : input wicket:id=numero type=text class=tipo size=12 and in the Java code : add(new TextField(numero) { public String getMarkupId() { return numero; } }.add(new NumeroFacturaValidador()). add(StringValidator.maximumLength(12)). setOutputMarkupId(true).add(new FieldFocusBehavior())); I don't know what I'm doing wrong, any help would be greatly appreciated. Jaime. * Jaime De La Jara [EMAIL PROTECTED]* wrote: Absolutely !, thanks a lot Igor, I'll try it right now. I agree that is an uncommon use case and it doesn't deserve an api change and a custom solution is what is needed. Jaime. *Igor Vaynberg [EMAIL PROTECTED]* wrote: ok, this is a bit tricky but is def doable. i dont think this is a very common usecase, so i dont think we will create all the factories/etc for you to be able to do this out of the box because in most cases it will just be api bloat. that said, although not trivial it is still def very possible start with extending the autocompletebehavior override getcallbackurl and do something like return super.getcallbackurl()++'limiter='+document.getelementbyid('someid').value); so now whenever the url is invoked for the autocomplete it will also contain a limiter param whose value will be the value of that textfield - make sure someid is the id of that textfield. then simply create your own component, or add the behavior directly to a textfield, see AutoCompleteTextField source - its rather trivial. now in your getchoices() you can do getrequest().getparameter(limiter) and that will give you that extra value you need to filter make sense? -igor On 3/26/07, Jaime De La Jara [EMAIL PROTECTED] wrote: Basically what I need is to narrow the possible choices of the autocomplete field, depending on the value the user entered in the other field (which is a normal field). This is a user requirement to simplify their data entry, in this case the normal field is an invoice number and the