+ {javascript name=jquery}
+ <script type="text/javascript">//<![CDATA[
+ var id = new Array();
+ id['choices'] = {$survey_current.choices|@count};
+ id['subquestions'] = {$survey_current.subquestions|@count};
+ {literal}
+ function newField(name, tid)
+ {
+ fid = "t" + id[name];
+ $("#" + name + "_" + tid).before('<div id="' + name + '_' + fid + '">'
+ + '<input id="' + name + '_' + fid + '_field" type="text" name="survey_question[' + name + '][' + fid + ']" size="50" maxlength="200" value="" /> '
+ + '<a href="javascript:removeField("' + name + '", "' + fid + '")"><img src="images/icons/delete.gif" alt="" title="Supprimer" /></a>'
+ + '</div>');
+ id[name]++;
+ $("#" + name + "_" + fid + "_field").focus();
+ }
+ function removeField(name, tid)
+ {
+ $("#" + name + "_" + tid).remove();
+ }
+ {/literal}
+ //]]></script>