Categories > TinyButStrong general >

Field ordering?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: TheIdeaMan
Date: 2004-12-01
Time: 02:15

Field ordering?

Does anyone know of a way to change the order of fields in a form or a table using TBS?

The idea being that users could customize what order they would like to see table fields or form fields. The conditional field abilities of TBS help for basic config settings like removing some fields. I was just curious if it would be possible to also allow them to set their order as well.

It's mostly just a curiosity, so no rush.

Thanks for the answer in advance though. :)
By: Skrol29
Date: 2004-12-02
Time: 00:08

Re: Field ordering?

Hi,

I can see a seay way if the number and the names of fields are always the same.

PHP:
// Arrange the order of field names, the result must be something like this:
$fields[0] = array('name'=>'city','caption'=>'Enter the city');
$fields[1] = array('name'=>'country','caption'=>'Enter the country');
...

// Merge field names and captions
$TBS->MergeField('field',$fields);

// Merge data
$TBS->MergeBlock('data',$conn,'SELECT city,country FROM adresse');

HTML:
<tr>[data;block=tr]
  <td>[field.0.caption] : [data.[field.0.name]]</td>
  <td>[field.1.caption] : [data.[field.1.name]]</td>
  <td>[field.2.caption] : [data.[field.2.name]]</td>
</tr>
By: TheIdeaMan
Date: 2004-12-02
Time: 15:00

Re: Field ordering?

Nice idea. Makes since.

Thanks, Skrol. That's a problem I've run up against in dealing with forms for some projects I'm working on. I'm trying to get my head far enough around TBS to promote it to one of the open source groups I'm working with. It would be great to see TBS be a major part of a large project.

Thanks again for the help.