%TMPL:INCLUDE{"Applications.ApplicationTopicEdit"}%
%TMPL:DEF{"detailstab"}%%TAB{"%TRANSLATE{"Details"}%"}%
%RENDERFOREDIT{
form="%TMPL:P{"formdefinition"}%"
exclude="^(TopicType|Summary|TopicTitle)$"
}%
<div class="topicTypeContainer">
%IF{"ForTopicType"
then="$percntTMPL:P{\"topictype::edit\"}$percnt"
}%
</div>
<script>
jQuery(function($) {
$("input[name='ForTopicType']").on("change", function() {
var topicType = $(this).val();
foswiki.loadTemplate({
"name": "Applications.TopicTemplateEditTemplate",
"expand": "topictype::edit",
"topicType": topicType,
"topic": "%WEB%.%TOPIC%"
}).then(function(data) {
$(".topicTypeContainer").html(data.expand);
});
});
});
</script>
%ENDTAB%%TMPL:END%
%TMPL:DEF{"topictype::edit"}%<h2 >%TRANSLATE{"Default Values"}%</h2>
%RENDERFOREDIT{
form="%TMPL:P{"topictype::form"}%"
exclude="^(%TMPL:P{"topictype::exclude"}%)$"
%RENDERFORMDEF{
form="%TMPL:P{"topictype::form"}%"
exclude="^(%TMPL:P{"topictype::exclude"}%)$"
format=" $name_attributes=\"\" $name_name=\"Set+FORMFIELD_$name\"$n $name_value=\"$percntENCODE{\"$percntFORMFIELD_$name{default=\"\"}$percnt\" type=\"quote\"}$percnt\"$n $name_default=\"\""
}%
}%
%RENDERFORMDEF{
form="%TMPL:P{"topictype::form"}%"
exclude="^(%TMPL:P{"topictype::exclude"}%)$"
format="<input type='hidden' name='Default+FORMFIELD_$name' value='' />"
}%
%TMPL:END%
%TMPL:DEF{"topictype::exclude"}%TopicTitle|TopicType%TMPL:END%
%TMPL:DEF{"topictype::value"}%%URLPARAM{"topicType" default="%FORMFIELD{"ForTopicType"}%"}%%TMPL:END%
%TMPL:DEF{"topictype::form"}%%IF{"'%TMPL:P{"topictype::value"}%'/TopicType=~'TopicStub'"
then="%FORMFIELD{"Target" topic="%TMPL:P{"topictype::value"}%"}%"
else="%TMPL:P{"topictype::value"}%"
}%%TMPL:END%