我一直试图通过使用Bootstrap 3在表单上单击“提交”按钮来使行动态显示。我可以输入一个名称,单击“提交”,行(应该是我想的面板)应该像预期的那样显示,但是当我输入第二个名称时,先前创建的行将被该名称覆盖,我不确定为什么。我想通过使用php文件来实现此目的,因为我希望通过curl发送值并使用rest接口,但是问题是使我的行正常工作。
我有一个问题:为什么我只计划创建一行而不是多个副本。
这是我的代码:
<html lang="en">
<head>
<title>Bootstrap Jquery Add More Field Example</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">Add/Remove Names</div>
<div class="panel-body">
<form>
<input type='hidden' name ='topic' value='<?=$topic?>' onchange="rememberField(this)"/>
<div class="input-group control-group after-add-more">
<input type="text" name="name" id="name" class="form-control" placeholder="Enter Name Here">
<button type="submit" class="btn btn-default add-more">Submit</button>
</div>
</form>
<!-- Copy Fields -->
<div class="copy">
<div class="control-group input-group" style="margin-top:10px">
<?php $name = $_GET['name']; ?><p><?=$name?></p>
<div class="input-group-btn">
<button class="btn btn-danger remove" type="button"><i class="glyphicon glyphicon-remove"></i> Remove</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$(".add-more").click(function(){
var html = $(".copy").html();
$(".after-add-more").after(html);
});
$("body").on("click",".remove",function(){
$(this).parents(".control-group").remove();
});
});
</script>
</body>
</html>
答案 0 :(得分:0)
您需要在输入字段中将name属性更改为
;with cte as
(
select
distinct [Brand Code],[Product Description]
from dbo.Harsha_2
where [Product Description] is not null
)
select
--t1.F1,
t1.[Brand Code], t1.[Product Description]
, ISNULL(t1.[Product Description],t2.[Product Description]) [Product Description]
, t1.[WeekNo],t1.[Quantity]
from dbo.Harsha_2 t1
left join cte t2 on t1.[Brand Code]=t2.[Brand Code]
--order by [Brand Code]
到
name="name"