Forum OpenACS Q&A: Re: break out of a multiple tag?

Collapse
Posted by Tilmann Singer on
If the multirow is created from a db call directly then you can do it like this:

db_multirow elements elements { } {
  if bla {
    break
  }
}

If you create it manually do the analogue to this in your code.

Follows the good principle of not putting unnecessarily logic into the adp file.

Collapse
Posted by tammy m on
Hmm,

Well actually what I'm doing is surely considered a major hack approach but I'm trying to get something done relatively quickly and painlessly here (getting some functionality up is more important now than elegance or generic reuse)...

What I am doing is creating a custom form resource/style (replacing standard-lars) that is paired with a specific form to handle pairing certain widgets into single table rows, etc.

I know I could do this with an adp using the formwidget/formerror/etc tags but then I would have to write a lot of html table code and include every formwidget and it would be long and tedious. But the generic form style is not gonna work either since it lays all widgets out one per table row. I need several to be paired in a single table row in some cases etc.

Maybe the correct way to be doing this is using something I ran across in the Templating System docs:

Starting with an autogenerated form template

In most cases, the simplest way for the designer to get started is to edit the autogenerated form template. This template will have all the necessary formwidget and formgroup tags.

But how do I get my autogenerated form template with the formwidget tags in it?!

Of course my form adp will still be long and any added widgets will need to be added by hand (the tcl and adp kept in sync) versus picked up in the style multiple name=elements loop for free.

It's frustrating how very close the standard form style comes to a perfect form rendering for almost no effort (formtemplate tag only). Then for just a tiny bit of customization from that for a single form, I have to write a load of formwidget | formerror | formgroup tags and my own HTML structure. Sigh. If only I had time/knowledge right now to add

  1. more flexible form sections -- template::element::create accepts a section and if not defined yet, defines it. Any elements later added via template::element::create can be added to existing or new sections.
  2. associating widgets so that when "linked" to each other, the standard template displays them in the same row, separated by their labels (if they have them).
  3. This would rock! Then I'd be able to just use a single formtemplate tag for all my forms, even the huge ones generated from CR content_types:)

    Alas I am a newbie and am struggling to implement a site with specific functionality in a decent time frame to prove we can use ACS for our purposes. So hacking a form style template seems the way to go now!

    Which brings me back to: should I continue to hack the custom-per-form style templates (only for really large, CR-generated forms that have to be "per designer's specs" visually) or figure out how to get my autogenerated template containing the formwidget etc tags and hand tweak that?

    sorry for the verbosity and tia:)

    btw, I still think it'd be mighty handy to be able to break or continue from within a multiple tag;(