Ciao,
i have some descriptions and i need to setup autofocus to a specific description when i open a form. I don't found any description property for setup it. I create for MADescription beAutofocus self propertyAt: #autofocus put: true isAutofocus ^ self propertyAt: #autofocus ifAbsent: [ false ] and for MADescriptionComponent isAutofocus ^ self magritteDescription isAutofocus And for MATextInputComponent i change the: renderInputOn: html self isAutofocus ifTrue:[html textInput id: self labelId; autofocus; on: #string of: self] ifFalse:[ html textInput id: self labelId; on: #string of: self] Now I wonder if it is a good solution ? Because i need to change some rendering for other components ( MATextAreaComponent - MASelectListComponent ecc.. ecc ) Any considerations are welcome. Thanks, Dario _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Hi Dario,
I am not too fond of putting this in the base of Magritte, especially in the rendering method, as: - this is a html-5 extension. - you need to implement this all input components. - It is a bit ambiguous when it is set to multiple descriptions. - It does not work together with a javascript. So I think you should rather: - create a HTML5 extension (Magritte-SeasideHTML5). - Put in this package > the properties as extension methods > set focus by javascript. This is needed for more complex things. This more general solution is probably interesting for more people. Or: make a custom component: "MyAutoFocusTextInputComponent" that overrides the rendering method, and use it where you need the autofocus. This is easy, small and useful for your own project. Cheers, Diego On Dec 16, 2013, at 12:32 PM, [hidden email] wrote: > Ciao, > > i have some descriptions and i need to setup autofocus to a specific description when i open a form. > > > I don't found any description property for setup it. > > I create for MADescription > > beAutofocus > self propertyAt: #autofocus put: true > > isAutofocus > ^ self propertyAt: #autofocus ifAbsent: [ false ] > > > > and for MADescriptionComponent > > isAutofocus > ^ self magritteDescription isAutofocus > > > > And for MATextInputComponent i change the: > > renderInputOn: html > > self isAutofocus > ifTrue:[html textInput > id: self labelId; > autofocus; > on: #string of: self] > ifFalse:[ html textInput > id: self labelId; > on: #string of: self] > > > > Now I wonder if it is a good solution ? > > Because i need to change some rendering for other components ( MATextAreaComponent - MASelectListComponent ecc.. ecc ) > > Any considerations are welcome. > > Thanks, > > Dario > > > > _______________________________________________ > Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Free forum by Nabble | Edit this page |