Categories > TinyButStrong general >

frm with select

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: cookie
Date: 2006-07-20
Time: 13:43

frm with select

With TBS < 3.0 something like that was possible:
<option>01</option>
.
.
.
<option>31</option>
<option>[var.date;frm=dd;selected]</option>

When i try this with TBS > 3.0:
<option>01</option>
.
.
.
<option>31</option>
<option>[var.date;frm=dd;ope=html;select]</option>
it doesn't work!
any suggestion?
By: Skrol29
Date: 2006-07-20
Time: 14:30

Re: frm with select

Hi,

That's true, int TBS 3 parameter "ope" is processed before "frm".

So I can see two ways:
1/ create another global variable for the formated value
  or :
2/ use parameter "onformat". (unfortunaltely only parameters "onformat" and "script" are processed before "ope").

I'll see if I can make "frm" be processed before "ope" when using the HTML plug-in.
By: cookie
Date: 2006-07-20
Time: 15:58

Re: frm with select

Hi

I'm doing this in a block, so creating a global variable is suboptimal ;)
So i think i will try 'onformat'.

Make TBS processing 'frm' before 'ope' would be very nice

anyway thx for info
By: Skrol29
Date: 2006-07-20
Time: 17:45

Re: frm with select

In a block, "ondata" is much more optimal than "onformat". You can chnage the current value of the column, or even create a new column containg the formated value.
By: cookie
Date: 2006-07-26
Time: 16:10

Re: frm with select

Workaround with ondate

TBS-Code
<tr>
    <td align="right">[field.titel;ondata=m_event_datefrm;block=tr;when [field.type;noerr]=date]:</td>
    <td>
        <select name="[field.name][]" size="1">
            <option>01</option>
            <option>02</option>
            <option>03</option>
            <option>04</option>
            <option>05</option>
            <option>06</option>
            <option>07</option>
            <option>08</option>
            <option>09</option>
            <option>10</option>
            <option>11</option>
            <option>12</option>
            <option>13</option>
            <option>14</option>
            <option>15</option>
            <option>16</option>
            <option>17</option>
            <option>18</option>
            <option>19</option>
            <option>20</option>
            <option>21</option>
            <option>22</option>
            <option>23</option>
            <option>24</option>
            <option>25</option>
            <option>26</option>
            <option>27</option>
            <option>28</option>
            <option>29</option>
            <option>30</option>
            <option>31</option>
            <option>[field.frmdate.0;ope=html;select]</option>
        </select>
        <select name="[field.name][]" size="1">
            <option>01</option>
            <option>02</option>
            <option>03</option>
            <option>04</option>
            <option>05</option>
            <option>06</option>
            <option>07</option>
            <option>08</option>
            <option>09</option>
            <option>10</option>
            <option>11</option>
            <option>12</option>
            <option>[field.frmdate.1;ope=html;select]</option>
        </select>
        <select name="[field.name][]" size="1">
            <option>2001</option>
            <option>2002</option>
            <option>2003</option>
            <option>2004</option>
            <option>2005</option>
            <option>2006</option>
            <option>2007</option>
            <option>2008</option>
            <option>2009</option>
            <option>2010</option>
            <option>2011</option>
            <option>2012</option>
            <option>[field.frmdate.2;ope=html;select]</option>
        </select>
    </td>
</tr>

PHP-Code:
function m_event_datefrm($BlockName,&$CurrRec,$RecNum){
    $CurrRec['frmdate'] = explode('-', date('d-m-Y', $CurrRec['value']));
}

just for the case someone else want to do such thing