Categories > TinyButStrong general >

if then else ...

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Uwe
Date: 2003-04-06
Time: 18:41

if then else ...

Hy

Thanks for quick answer. It's realy a pleasure to work with TBS.
But there are some more problems.

I try to use if-then-else to replace a date with the current date from today. But it don't work. The HTML code looks like:

<td<input type="Text" name="news_from"
  value="[[b_news.news_from];if [b_news.news_from]=2000-01-01; then [sys.now;frm='yyyy-mm-dd']; else [b_news.news_from]]" size="10" maxlength="10">News valid from (JJJJ-MM-DD)</td>

Then I still have trouble with a couple of checkboxes.

<tr><td><input type='Checkbox' name='news_cont[]' value="[b_cont.cont_ID]"> [b_cont.cont_text;block=td]</td></tr>

I have a lot of them comming out of the data base and some of them have to set as selected (according another querry). To show them on screen is no problem but how to set some of them selected?

thanks
Uwe
By: Skrol29
Date: 2003-04-06
Time: 20:08

Re: if then else ...

Hi Uwe,

About the if-then-else statement, the problem seems to be in your merge-field id. Try:
value="[b_news.news_from;if [val]=2000-01-01; then [sys.now;frm='yyyy-mm-dd']; else [val]]"

- 'if', 'then' and 'else' are paremeters of the merge-field.
- the [val] keyword enables you to indicates the value of the current field within its parameters.

About how to get a check-box selected:
It depends on where the information comes from. If it comes from a data base, the best way is to add a column wich contains 'selected' or '' in the query that returns all check-box items.

An other way is to use a 'tbs_check' field with a if-then-else statement.

If you give more details on you problem I could write some code.

By the way, TBS has a special parameter wich allows to select a value in a combobox. But due to HTML syntax, this parameter is not yet available for check-boxes.