Re: [Cppcms-users] Custom form rendering and dynamic widgets
Brought to you by:
artyom-beilis
From: Julian P. <ju...@wh...> - 2010-08-30 23:52:32
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 30.08.2010 06:15, schrieb Artyom: >> May I use a construct like >> <% foreach widget in form %> here? > > Yes, you can. > > See: http://art-blog.no-ip.info/cppcms_ref_v0_99/classcppcms_1_1form.html > > it has forward iterator in it and thus you can iterate over the > form. > > There is an example from src/hello_world_view1.tmpl > > > <% foreach w as cppcms::form::iterator in form %> > <% separator %><br/><% item %> > <% if w.has_message() %><% w.message() %>:<% end %> > <% form input w %> > <% if not w.valid() %>:<% w.error_message() %><% end %> > <% end %> > <% end %> > > Artyom > > Ok, thanks for this example. But I still have a problem: Because even the forms on this page are dynamically allocated, they are stored in a vector, and because they are not copyable, I store a booster::shared_ptr to them instead. I loop with <% foreach form in forms %> But the problem is, that now the following construct <% foreach w as cppcms::form::iterator in form %> does not work, because the template generator expects form to be the object itself (and therefore generates form.begin() and form.end() instead of form->begin() and form->end() which would have to be used here). Is there a way around this apart of editing the generated template afterwards? Thanks, Julian -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMfEQ0AAoJENidYKvYQHlQOc8QAMrII619eMkDxv5mMdr341d9 mlqHIMpmJUPB5NwT1sqcoftHW3+6LkBVKSvx9VciOK8PnOaxZEEBW7K479RM943Q 9Pt1m2fBckJi7SQ0UGIaHqr/7rcpkkDNf6x8z/X8KYLWfYI0Jr7OYKKv1pSKTqYT cMepd64wvxxbpdZ1xN1Cw0frB82bTIsO9xek3ZkgDdIfMQ8/NzmLK/bz2/KdJf8c wSYT+3kZS7e4X7/84MgTsVwaLRnOpVyU5m2xzaZfWMeib/FbZWY1RsxMqEzTfaqW cplWPoEJV6zzfRIB7IVTfNd83fQTHu0X3gmnOSq6BnZufK7n5XLc2io2UMGlPWds oFlaJDqwKZL4Hvqd5zCp0e1RcK6m3rRd6+U/vyBZ+Z+Ye480Ubd5VlmdKAmOts8d APdwOJ21xHqj8sfzLAv84hbKDwwbXR54uF7DoqI5rKxwQkRry231wMORjjC1DsII tXQ/zrpT5iMZB8hFxlVIBq4rdQLg2Syfr+LM/6QZN5H9cvhSULlwP6/PMtyMljqe XglId5HmL6uQkjI5D4hagVz4ddqr6uiQAzy+0RGt/0WuE2sx0WR8zkee6hbsLAAx i6fgzuJ9AgDXJOHrfgCJKe1ulRoZjFjpKoRNQBt0aUH2L/LCmrUDdAQkDS+mOUOa vN71su/IIWaudH0/ISsB =hR8o -----END PGP SIGNATURE----- |