Php 在更改特定表单元素时动态添加社交引擎表单元素

Php 在更改特定表单元素时动态添加社交引擎表单元素,php,socialengine,Php,Socialengine,我是SE4.20的新手。更改此表单元素后,我在创建表单元素时遇到问题 为了解释, 我有一张表格。我能够在更改此表单元素时返回一些select选项值。但现在我想在这个元素的更改上添加一个form元素 如果用户更改选择框,是否要添加表单元素(如文本框)?可能是这样的: $("#selectBoxId").change(function (){ $("#formId").append("<input type='text' name='additionalFormElement' /&g

我是SE4.20的新手。更改此表单元素后,我在创建表单元素时遇到问题

为了解释,
我有一张表格。我能够在更改此表单元素时返回一些select选项值。但现在我想在这个元素的更改上添加一个form元素

如果用户更改选择框,是否要添加表单元素(如文本框)?可能是这样的:

$("#selectBoxId").change(function (){
    $("#formId").append("<input type='text' name='additionalFormElement' />");
});
$(“#selectBoxId”).change(函数(){
$(“#formId”)。追加(“”);
});
以下是html:

<div class="form-elements">
<div id="typeName-wrapper" class="form-wrapper">
    <div id="typeName-label" class="form-label">
        <label for="typeName" class="required">Type</label>
    </div>
    <div id="typeName-element" class="form-element">
        <select name="typeName" id="typeName">
            <option value="Grant">Grant</option>
            <option value="Cooperative Agreements">Cooperative Agreements</option>
            <option value="Publication">Publication</option>
        </select>
    </div>
</div>
<div id="resourceName-wrapper" class="form-wrapper">
    <div id="resourceName-label" class="form-label">
        <label for="resourceName" class="required">Name</label>
    </div>
    <div id="resourceName-element" class="form-element">
        <select name="resourceName" id="resourceName">
            <option value="ABC">ABC</option>
            <option value="XYZ">XYZ</option>
        </select>
    </div>
</div>

类型
授予
合作协议
出版
名称
基础知识
XYZ

以下是mootool js:

 $('typeName').addEvent('change', function(event) {
        var typeName = $('typeName').value;
        var base_path = "<?php echo $this->baseUrl();?>/";
        var url = 'http://xxxxxxx.com/test/resource/getresourcebytype';
        var request= new Request.JSON({
            url: url,
            method: 'GET',
            data: {"typeName":typeName},
            onSuccess: function( response )
            {
                console.log(response);
                //clear the select box
                var name = $('resourceName');
                while (name.firstChild) {
                    name.removeChild(name.firstChild);
                }
                //now add new option
                for (var i = 0; i < response.length; i++){
                    console.log(response[i]);
                    new Element('option', {'value': response[i].value, 'text':response[i].label}).inject(name);
                }

            }, onFailure: function(){

                console.log('failed');
            }
        });
        request.send();
    });
$('typeName')。添加事件('change',函数(事件){
var typeName=$('typeName')。值;
var base_path=“/”;
var url='1〕http://xxxxxxx.com/test/resource/getresourcebytype';
var request=new request.JSON({
url:url,
方法:“GET”,
数据:{“typeName”:typeName},
onSuccess:函数(响应)
{
控制台日志(响应);
//清除“选择”框
变量名称=$('resourceName');
while(名字,第一个孩子){
name.removeChild(name.firstChild);
}
//现在添加新选项
对于(变量i=0;i