用户提交包含一些基本数据的表单.
数据由控制器中的动作接收和处理,并且添加了需要保持私有的更多信息.
然后我需要向外部网站发送一个发布请求,其中包含来自控制器的所有组合数据.
做这个的最好方式是什么?
我在表单的末尾有一个提交按钮.
我在提交按钮中添加了以下条件:
onClick="this.disabled=true;
this.value='Sending…';
this.form.submit();"
Run Code Online (Sandbox Code Playgroud)
但是当它移动到下一页时,参数没有通过,并且传递了空值.
我有一个上传文件并在页面上定位iframe的表单.当用户单击提交时,我希望文件内容"清除".
我试过这个
$('#imageaddform').submit(function(){
$('#imagefile').val('');
});
Run Code Online (Sandbox Code Playgroud)
但是它会在提交之前清除表单,因此不会上传任何内容.
提交后如何清除?
我正在尝试使用jQuery发送表单的数据.但是,数据无法到达服务器.你能告诉我我做错了什么吗?
<form id="contactForm" name="contactForm" method="post">
<input type="text" name="nume" size="40" placeholder="Nume">
<input type="text" name="telefon" size="40" placeholder="Telefon">
<input type="text" name="email" size="40" placeholder="Email">
<textarea name="comentarii" cols="36" rows="5" placeholder="Message"></textarea>
<input id="submitBtn" type="submit" name="submit" value="Trimite">
</form>
Run Code Online (Sandbox Code Playgroud)
使用Javascript:
<script type="text/javascript">
$(document).ready(function(e) {
$("#contactForm").submit(function() {
$.post("getcontact.php", $("#contactForm").serialize())
// Serialization looks good: name=textInNameInput&&telefon=textInPhoneInput etc
.done(function(data) {
if (data.trim().length > 0) {
$("#sent").text("Error");
} else {
$("#sent").text("Success");
}
});
return false;
})
});
</script>
Run Code Online (Sandbox Code Playgroud)
和服务器端:
$nume = $_REQUEST["nume"]; // $nume contains no data. Also tried $_POST
$email = $_REQUEST["email"]; …Run Code Online (Sandbox Code Playgroud) 有人可以帮助改变它,以包含一个名为BUTTON1.JPG而不是标准submit按钮的图像?
<form id='formName' name='formName' onsubmit='redirect();return false;'>
<div class="style7">
<input type='text' id='userInput' name='userInput' value=''>
<input type='submit' name='submit' value='Submit'>
</div>
</form>
Run Code Online (Sandbox Code Playgroud) <form method="post" action="load_statements.php?action=load" id="loadForm"
enctype="multipart/form-data">
Run Code Online (Sandbox Code Playgroud)
that is my form, which looks fine to me. in that form, i put this button:
<input type="button" name="submit" id="submit" value="Submit" onclick="confirmSubmit()" class="smallGreenButton" />
Run Code Online (Sandbox Code Playgroud)
here is the function it calls:
function confirmSubmit() {
// get the number of statements that are matched
$.post(
"load_statements.php?action=checkForReplace",
{
statementType : $("#statementType").val(),
year : $("#year").val()
},
function(data) {
if(data['alreadyExists']) {
if( confirm("Statements already exist for " + $("#statementType").html() + " " + $("#year").val() +
". Are you sure you …Run Code Online (Sandbox Code Playgroud) 在angularjs中,我想知道ng-submit和ng-click之间的区别是什么?具体来说,每个人的利弊何时应该是一个还是另一个?谢谢!
**编辑**
我已经对此进行了一些调查,但我仍然想知道使用ng-submit的好处是什么(如果有的话)?您是否可以使用ng-click代替所有ng-submit?这会导致任何问题吗?再次感谢!
标题不言自明......我有几种形式,其中一种只是一个文本输入形式,另一种是由两个文本输入组成.我不希望其中任何一个提交按钮,我希望每当用户在任何文本输入处按下ENTER按钮时提交每个表单:
是否有办法使具有多个文本输入的表单以这种方式运行并避免在其中设置提交按钮?
我对这一切都很陌生.我正在使用ASP.NET MVC C#LINQ to SQL.
我有一个编辑页面,可以加载作者及其所有书籍.通过Ajax调用加载Books .
<script type="text/javascript">
$(document).ready(function() {
LoadBooks();
});
function LoadBooks() {
$(".Books").hide();
$(".Books").load("/Books/Edit/<%= Model.AuthorID %>");
$(".Books").show('slow');
}
</script>
Run Code Online (Sandbox Code Playgroud)
这部分工作正常.页面加载作者信息,然后加载书籍(DIV id ="Books"中的部分视图,只有书籍类别和书名):
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Solution.Controllers.BooksController+BooksViewModel>" %>
<% using (Html.BeginForm(null,null, FormMethod.Post,new { id = "bookform" }))
{%>
<fieldset>
<legend>Books</legend>
<%int i = 0;
foreach (var book in Model.Books)
{%>
<%= book.BookID%>
<%= Html.Hidden("book[" + i + "].BookID", book.BookID) %>
<%= Html.DropDownList("book[" + i + "].CatID", new SelectList(Model.Categories, "CatID", "CatTitle", book.CatID))%>
<%= Html.ValidationMessage("CatID", …Run Code Online (Sandbox Code Playgroud) 我是AngularJS的鱼,我有这个场景.
<form>
<input type="text">
</form>
<button type="submit">submit</button>
Run Code Online (Sandbox Code Playgroud)
在正常情况下,AngularJS提供ng-submit指令作为表单中的属性,但我需要在外面调用它.
那么,有人遇到过同样的问题吗?如果是的话,你做了什么?
form-submit ×10
forms ×5
jquery ×5
html ×4
javascript ×3
angularjs ×2
ajax ×1
asp.net-mvc ×1
html5 ×1
jsp ×1
php ×1
request ×1
ruby ×1
submit ×1
web ×1