your Css selector is wrong. Check JQuery docs
#myId is used for 'id'
in your HTML I see you have 'name'

so the selector should be: [name=consultContainer:consultPanel:field1]

On Tue, May 10, 2011 at 7:10 PM, Vitor Granzinoli Vellozo
<[email protected]> wrote:
>
> Stephen,
>
> It is exactly what I'm doing.
>
>
> I created a JQuery Behavior like this:
>
> public class JQueryCoreBehavior extends AbstractBehavior implements IBehavior 
> {
>
>        private static final long serialVersionUID = 2771256665618274523L;
>
>        private static final ResourceReference JQUERY_JS = new 
> JavascriptResourceReference(JQueryCoreBehavior.class,
>                        "jquery-1.6.min.js");
>
>        @Override
>        public void renderHead(IHeaderResponse response) {
>                response.renderJavascriptReference(JQUERY_JS);
>        }
>
> }
>
>
> And I created a AutoTab Behavior, to find all TextFields into a Panel (:input 
> was not working) like this:
>
> public class AutoTabBehavior extends JQueryCoreBehavior {
>
>        private static final long serialVersionUID = -4281584400887683393L;
>
>        private static final ResourceReference AUTOTAB = new 
> JavascriptResourceReference(AutoTabBehavior.class,
>                        "jquery.autotab-1.1b.js");
>
>        private List<Component> componentList;
>
>        @Override
>        public void renderHead(IHeaderResponse response) {
>                super.renderHead(response);
>                response.renderJavascriptReference(AUTOTAB);
>                componentList = new ArrayList<Component>();
>        }
>
>        @Override
>        public void onComponentTag(Component component, ComponentTag tag) {
>        }
>
>        @Override
>        public void onRendered(Component component) {
>                super.onRendered(component);
>                component.setOutputMarkupId(true);
>
>                Response response = component.getResponse();
>                response.write(JavascriptUtils.SCRIPT_OPEN_TAG);
>
>                response.write("var $j = jQuery.noConflict();");
>                response.write("$j(document).ready(function() {");
>
>                response.write("$j('");
>
>                if (component instanceof Panel) {
>                        Panel panel = (Panel) component;
>                        Iterator<Component> iterator = (Iterator<Component>) 
> panel.iterator();
>                        while (iterator.hasNext()) {
>                                Component component2 = iterator.next();
>                                if (component2 instanceof TextField) {
>                                        componentList.add(component2);
>                                }
>                        }
>                }
>
>                StringBuffer ids = new StringBuffer(1000);
>                for (Component c : componentList) {
>                        ids.append("#" + c.getPath().subSequence(7, 
> c.getPath().length()) + ",");
>                        System.out.println(c.getPath());
>                }
>
>                response.write(ids.toString().trim().substring(0, 
> ids.toString().length() - 1));
>
>                response.write("').autotab_filter('numeric');");
>
>                response.write("});");
>                response.write(JavascriptUtils.SCRIPT_CLOSE_TAG);
>        }
>
> }
>
>
> Inside a Panel, I put add(new AutoTabBehavior());
>
> The HTML output (RESULT) is:
>
> <div style="border-top: 0px; border-bottom: 0px;" id="consultContainer7">
>        <span></span> <--WHERE THE PANEL IS ADDED
> </div>
>
>
> The HTML that is generated to replace the span is:
>
> <div style="border-top: 0px; border-bottom: 0px;" id="consultContainer7">
>                        <span id="consultPanele">
>                                <table width="90%" align="center">
>                                <tr>
>                                        <td class="td_label" width="25%">
>                                                <label>
>                                                        
> Field1/Field2/Field3/Field4
>                                                </label>
>                                        </td>
>                                        <td class="td_dados">
>                                                <label>
>                                                        <input type="text" 
> size="3" maxlength="3" class="blk2" value="" 
> name="consultContainer:consultPanel:field1"/>
>                                                </label>
>                                                <label>
>                                                        <input type="text" 
> size="3" maxlength="3" class="blk2" value="" 
> name="consultContainer:consultPanel:field2"/>
>                                                </label>
>                                                <label>
>                                                        <input type="text" 
> size="6" maxlength="6" class="blk2" value="" 
> name="consultContainer:consultPanel:field3"/>
>                                                </label>
>                                                <label>
>                                                        <input type="text" 
> size="4" maxlength="4" class="blk2" value="" 
> name="consultContainer:consultPanel:field4"/>
>                                                </label>
>                                        </td>
>                                </tr>
>                </table>
> </span>
> <script type="text/javascript"><!--/*--><![CDATA[/*><!--*/
> var $j = jQuery.noConflict();
> $j(document).ready(function() {
>        
> $j('#consultContainer:consultPanel:field1,#consultContainer:consultPanel:field2,#consultContainer:consultPanel:field3,#consultContainer:consultPanel:field4').autotab_filter('numeric');});
>
>
> Some suggestions?
>
> Thanks all,
> Vitor
>
>
>
>
> -----Mensagem original-----
> De: Scardamalia, Stephen [mailto:[email protected]]
> Enviada em: terça-feira, 10 de maio de 2011 13:36
> Para: [email protected]
> Assunto: RE: AutoTab
>
> Hi Vitor,
>
> This looks like it might do what you need: 
> http://www.mathachew.com/sandbox/jquery-autotab/ using its 
> "$(':input').autotab_magic()" syntax. If you want to apply it only to certain 
> fields that may be dynamically included/excluded, apply a CSS class to the 
> fields you're interested in, then use JS/JQuery to select all instances of 
> that class to apply the plugin behavior.
>
> Haven't done any JQuery in a while but I'd think something like:
> <input name="1" class="autoTab"/>
> <input name="2" class="autoTab"/>
>
> $('.autoTab').autotab_magic();
>
> Stephen
>
> -----Original Message-----
> From: Vitor Granzinoli Vellozo [mailto:[email protected]]
> Sent: Tuesday, May 10, 2011 10:27 AM
> To: [email protected]
> Subject: RES: AutoTab
>
>
> Yes. Imagine the Field date that has 10 digits, imagining with a mask 
> (dd/MM/yyyy), when the person
> finish the typing of year, the cursor automatically jump to the next 
> component.
>
> So, it happens again, and again, till arrives to confirm button or something 
> else that will do the
> submit.
>
>
> -----Mensagem original-----
> De: Martin Makundi [mailto:[email protected]]
> Enviada em: terça-feira, 10 de maio de 2011 11:04
> Para: [email protected]
> Assunto: Re: AutoTab
>
> Ah, so you mean auto jump..after keypress or something.
>
> **
> Martin
>
> 2011/5/10 Vitor Granzinoli Vellozo <[email protected]>:
>>
>> Because the application is for a Telephone Central, so the people Will use 
>> that, need be
>> very fast, the time of each attendance is recorded, so they gain time if do 
>> not need type <TAB> to
>> jump to the next Field.
>>
>> Everything must be very fast, lot of Ajax.
>>
>>
>> -----Mensagem original-----
>> De: Martin Makundi [mailto:[email protected]]
>> Enviada em: terça-feira, 10 de maio de 2011 10:25
>> Para: [email protected]
>> Assunto: Re: AutoTab
>>
>> Why do you want auto tab and not just add tabindex?
>>
>> **
>> Martin
>>
>> 2011/5/10 Vitor Granzinoli Vellozo <[email protected]>:
>>>
>>>
>>> Wicketers,
>>>
>>>
>>>
>>> Someone knows if theres is a way to enable auto tabbing on wicket
>>> components that are inside a Form (for example)?
>>>
>>> So, when I full a TextField with the maximum caracters, the cursor
>>> automaticaly jump to the next component.
>>>
>>>
>>>
>>> Someone knows something about that?
>>>
>>>
>>>
>>> I created a behavior to JQuery and for a JQuery plugin that does that,
>>> but it's not work, I think it's not work because
>>>
>>> the panel where it uses the behavior not apears in the generated (final)
>>> HTML, so the javacript inserted does not
>>>
>>> have effect, am I right?
>>>
>>>
>>>
>>> Some solution for AutoTab?
>>>
>>> Wicket have something like component.setAutoTab(true); ? (if not, it
>>> could be excelent!)
>>>
>>>
>>>
>>> Thanks
>>>
>>> Vitor
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Atenciosamente,
>>>
>>> Vitor Granzinoli Vellozo
>>>
>>> Applications Outsourcing
>>>
>>>
>>>
>>> CPM Braxis
>>>
>>> Tel: 55 21 3213 9400
>>>
>>> Cel: 55 21 8896 5676
>>>
>>> www.cpmbraxis.com
>>>
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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

Reply via email to