Categories > TinyButStrong general >

html plugin weirdness / possible bug

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: ege
Date: 2010-10-27
Time: 19:05

html plugin weirdness / possible bug

Hi there,

I needed to use the html plugin and encountered 2 issues:

1)
<select id='theYear' name='sonEtkinlikTarihi[]'>
   <option value='0'></option>
   <option value='[years.val;block=option]'>[years.val]</option>
   <option value=''>[var.btm.existingForm.sonEtkinlikTarihi;noerr;frm=yyyy;ope=html;select]</option>
</select>

var.btm.existingForm.sonEtkinlikTarihi is a dateTime field that comes from MySQL, but the select options are in YYYY format, so for the html plugin to select the correct year, I utilized frm=yyyy. But this doesn't work. I think frm is either not processed before ope=html;select, or not processed at all.

2) I was trying to debug that code, and to see if everything works outside the select block I wrote [var.btm.existingForm.sonEtkinlikTarihi;noerr;frm=yyyy] somewhere completely unrelated. It worked as expected, then I changed it to the original [var.btm.existingForm.sonEtkinlikTarihi;noerr;frm=yyyy;ope=html;select]. This caused my entire page to stall, I had to close the browser window. I can repeat this, every time this code runs outside a select box, Apache server struggles but never returns. I know I put this piece of code in a wrong place but hanging an entire php script is a too harsh response, I'd rather expect TBS to fail gracefully.

Best regards,
ege.

PS: Yes, [years] block is merged before existingForm. TBS version is 3.6.0.
By: ege
Date: 2010-10-27
Time: 19:40

Re: html plugin weirdness / possible bug

Hrmmf, I have encountered yet another problem:
        <li>
          <span class='label'>Bu güne kadar İstanbul AKB GP’de düzenlenen hangi <strong>destek eğitimlerine</strong> katıldınız?</span>
          <input type='checkbox' name='destekEgitimleri[]' value='Sivil Toplum ve Gönüllülük Eğitimi' /> Sivil Toplum ve Gönüllülük Eğitimi <br />
          <input type='checkbox' name='destekEgitimleri[]' value='Etkinlik Koordinasyon Eğitimi' /> Etkinlik Koordinasyon Eğitimi <br />
          <input type='checkbox' name='destekEgitimleri[]' value='Ülke ve Kültürlerarası Öğrenme Eğitimi' /> Ülke ve Kültürlerarası Öğrenme Eğitimi <br />
          [var.btm.existingForm.destekEgitimleri;noerr;ope=html;select=destekEgitimleri[];selbounds=li]
        </li>

It doesn't fill my checkboxes :( Perhaps because of [] in the names of the fields? How can I solve this?
By: Skrol29
Date: 2010-10-28
Time: 10:26

Re: html plugin weirdness / possible bug

Hi Ege,

1)
Yes, parameter "ope" is actually processed before "frm". The order of parameters is noticed here:
http://www.tinybutstrong.com/manual.php#html_field_prm_order
I think the best way is to add  a column in your query. Or use parameter "ondata" or "onformat".

2)
There is a known bug (which is not really a bug) that make this behavior when you use parameter "ope=html;select" for a field which is not embedded in a <select> element, and which has no parameter "selbounds".

3)
Try with:
[var.btm.existingForm.destekEgitimleri;noerr;ope=html;select='destekEgitimleri[]';selbounds=li]
By: ege
Date: 2010-10-28
Time: 16:06

Re: html plugin weirdness / possible bug

Thank you very much for helping, Skrol.

1) Ok, yes this information is in the documentation and I had to finish the work last night so I already used onformat. I didn't look at it the documentation while I was coding this, I expected it to work for some reason. In the future, maybe you can consider giving more power to template creator so that he can adjust the order of processing according to needs. In my case, it would be much easier and cleaner solution not to write an onformat function.

2) Ok :)

3) It was completely my fault, there was another mistake on the php side. It actually works even without the quotes now.

edit: About 1, I was thinking of a syntax like [(var.btm.existingForm.sonEtkinlikTarihi;noerr;frm=yyyy);ope=html;select]. Like in programming languages, can't we use parentheses as precedence specifier?
By: Skrol29
Date: 2010-10-28
Time: 16:20

Re: html plugin weirdness / possible bug

About the 1)
We're planning for TBS 4 to move parameter "frm" as an operator. Like "ope=frm:yyyy".
This is more logical and Ope operators are processed in order they are coded.
By: ege
Date: 2010-10-28
Time: 16:25

Re: html plugin weirdness / possible bug

Oooh, excellent. I completely agree that this is more logical. I hope no serious backward compatibility issues will arise.