[Seaside] FormElement focus after an update

Sebastian Sastre ssastre at seaswork.com
Wed Oct 3 13:21:45 UTC 2007


Hey there!
 
    it's me searching wrongly or there is no javascript to query which
element has focus in a form?
 
    We want some input text #change to update some component but after the
update the focus remains on it. Well in fact even better will be that the
focus remains in the different input text that had caused the #change to
trigger. 
 
    I've tried to emulate this by making the updater like this:
    [:html|
        html updater
            id: self id;
            evalScripts: true;
            callback:[:focusId| lastFocusId := focusId]
            value: (html formElement  
                id: (self at: aSymbol) inputElementId; id);
            callback:[:v | (self at: aSymbol) model setValue: v]
            value: (html formElement  
                        id: (self at: aSymbol) inputElementId;
                        value);
            callback:[:h| self renderInnerContentOn: h.
            h script: (h formElement id: lastFocusId; focus)];
            yourself
    ]
 
    but this does not work for some reason I dont get yet
 
    Did anyone managed to recover focus state in a similar scenario? any
idea on how to do it?            
 
Sebastian Sastre

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20071003/d7e041ee/attachment-0001.htm


More information about the Seaside mailing list