The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

firefoxSafari (2) [Avatar] Offline
#1
Hi! I finished reading this book a few days back. It was a very enjoyable, insightful read. I found your explanation of inheritance and plugins using Ext especially eye-opening. Chapter 15 alone is worth the price of admission. I also appreciated the explanation of Observable. You clearly took the time to think about how best to explain the concepts behind the framework rather than simply throwing a bunch of examples together. I know I’ll write better code for having read the book – thanks!

I do have one specific question regarding reusability. How do you deal with the name config option on classes like TextField? For example, say I want to subclass a FieldSet that is to display address information. It has some complex formatting and some complex logic dealing with zip code lookup filling in other fields etc. I’d like two instances of this on the same form, one for mailing address and one for physical address, maybe billing address too.

Given a scenario like this, what’s the best way to deal with the name attribute? Ideally, I would like to set the name on the individual items the FieldSet contains in the definition for the class, but I’m not sure it’s a good idea to depend on fields with the same name being received in a certain order on the server? I was thinking about passing in a config option that would be a unique string to append to all the names before any dom elements actually get rendered. Just curious how someone with your experience would solve this.
jesus.garcia (463) [Avatar] Offline
#2
Re: Reusability and the name config option
Hi,

I've gone the way of using dot or underscore notation for the field "names".

home.address1
home.address2
home.city
home.state
home.postal


work.address1
work.address2
work.city
work.state
work.postal

from here you can see the easy separation. smilie