Hello all,
This is my first post here, although I have been a reader for a long time.
I have this wonderful "Attachment mode" working correctly in my forum, but now I have added two combos to my "Posting" page. The problem is that, when the user uploads an attachment, the posting page is reloaded (as usual with this mode to show the uploaded file and wait for another attachment). After this reload, all the data introduced in the form is recovered and shown correctly.... except for my new combos.
This is one of the combos that I have added to "posting_body.tpl"
Code: Select all
<select name="tipo"><option value="0">perro</option><option value="1">gato</option></select>
"tipo" is something that I am storing in my data base. When mode is "newtopic" I am setting "tipo" to 0, and I "select" this value with this javascript on "initialize"
Code: Select all
document.post.tipo.options[{TIPO}].selected= true;
With this, when mode is "newtopic", the default combo selection is "perro".
When mode is "edit" I set "tipo" to the value stored in the data base.
The problem comes when I start a new topic. I fulfil the form including the combo but I have not submited anything yet. Now I attach a file and the posting page is reloaded. Everything that I wrote in the form comes back correctly, but not the combo slection that I made.
I think that the problem is that it is not a new topic (therefore "tipo" is not set anywhere and {TIPO} is empty , and in the other hand, as I have not submitted the post yet, there is nothing stored on my database, therefore, {TIPO} is still empty --> It produces a javascript error.
Could any of you help me with this?.
Thanks