I've created a two new categories on my blog called "XPages Newbie Tips" and "XPages Feedback". In posts under either of these categories, but especially "Newbie Tips" my goal is to be positive rather than my usual bitching about the product.
The idea for the newbie tips is that as I'm digging into serious development with XPages, I'm coming across things that would really have helped me if I knew them at the start. I plan to make these newbie tips into blog entries, and then as I get a good solid list of them together turn them into a sort of "Frequent Questions You Didn't Know You Should Ask" list.
The "XPages Feedback" category is for blog entries that I hope will spur discussion and consideration that gets to the designers of XPages at IBM. I know some of them keep an eye on what I write from time to time, so I'm sure the occasional positive comment may come as a welcome surprise.
This morning's tip is about the option "Create controls at page creation".
I believe this option is poorly labeled. It should say "Create controls ONLY at page creation". The current wording is "positive" and makes the option seem like an extra help, when in fact it's a LIMITING option. My thought was that by creating them at page creation it would make debugging easier since there would be less stuff changing dynamically on the page. Wow, was I wrong on that one!
Below the repeat was a panel that let me add a new document, which was to show up in the repeat list. The idea was when you clicked the submit button on the new document, the new document's fields would clear and the new document would be added to the repeat control list. I'd properly set the the partial refresh on the submit button to include the whole panel containing both the new document and the repeat control. It didn't work. For many, many hours I tried to find a way to update the repeat control. I went down several wrong paths, spending hours on each one. I asked a question on Stack Overflow as clearly as I could, and both Tim and Nathan made an effort to help me out. I spent more hours (and learned a few things from Tim's article) but nothing helped. Declan joined in, and I learned something new there as well -- but still no dice. Only through trial and error did I finally figure out what had caused my problem.
I had added some computed fields showing random numbers to a few parts of the XPage so I could tell when different parts would refresh. Finally, I discovered that the repeated elements were actually refreshing but I wasn't seeing a new entry added to the list. The reason, ultimately, turned out to be that to add another entry to the repeat list I needed a new "control" -- but I'd checked that box that said "Create Controls at Page Creation". It was preventing my XPage from creating another entry for the new document to display!
Aside from the things I learned from the debugging and the tips from Tim and Declan, an important XPages lesson was driven home about what an "XPage" really is, it's persistence, and what are considered "controls".
Comment Entry |
Please wait while your document is saved.
I'd guess that if we'd seen the repeat control with that setting enabled you'd
have been told to disable it on one of the answers.