在这个入门套件中 -
在这个文件中 - 发送表格,我如何发布我的PHP脚本,发送电子邮件。通过聚合物,我不明白。求助。
https://github.com/Polymer/shop/blob/master/src/shop-checkout.html
_submit(e) {
if (this._validateForm()) {
// To send the form data to the server:
// 2) Remove the code below.
// 3) Uncomment `this.$.checkoutForm.submit()`.
this.$.checkoutForm.dispatchEvent(new CustomEvent('iron-form-presubmit', {
composed: true}));
this._submitFormDebouncer = Polymer.Debouncer.debounce(this._submitFormDebouncer,
Polymer.Async.timeOut.after(1000), () => {
this.$.checkoutForm.dispatchEvent(new CustomEvent('iron-form-response', {
composed: true, detail: {
response: {
success: 1,
successMessage: 'Demo checkout process complete.'
}
}}));
});
// this.$.checkoutForm.submit();
}
}
答案 0 :(得分:1)
function (t, justOne) {
var parsed = this._parseRemove(t, justOne);
var query = parsed.query;
var justOne = parsed.justOne;
var wc = parsed.wc;
var collation = parsed.collation;
var result = undefined;
var startTime =
(typeof(_verboseShell) === 'undefined' || !_verboseShell) ? 0 : new Date().getTime();
if (this.getMongo().writeMode() != "legacy") {
var bulk = this.initializeOrderedBulkOp();
var removeOp = bulk.find(query);
if (collation) {
removeOp.collation(collation);
}
if (justOne) {
removeOp.removeOne();
} else {
removeOp.remove();
}
try {
result = bulk.execute(wc).toSingleResult();
} catch (ex) {
if (ex instanceof BulkWriteError || ex instanceof WriteCommandError) {
result = ex.toSingleResult();
} else {
// Other exceptions thrown
throw Error(ex);
}
}
} else {
if (collation) {
throw new Error("collation requires use of write commands");
}
this._validateRemoveDoc(t);
this.getMongo().remove(this._fullName, query, justOne);
// enforce write concern, if required
if (wc)
result = this.runCommand("getLastError", wc instanceof WriteConcern ? wc.toJSON() : wc);
}
this._printExtraInfo("Removed", startTime);
return result;
}
您必须已注意到您提供的link中的上述代码行。 单击提交按钮后,将执行以下步骤:
<iron-form id="checkoutForm"
on-iron-form-response="_didReceiveResponse"
on-iron-form-presubmit="_willSendRequest">
<form method="post"
action="data/sample_success_response.json"
enctype="application/x-www-form-urlencoded">
的验证。_validateForm()
iron-form-presubmit
,checkoutForm
将调用函数_willSendRequest
。请参阅属性:on-iron-form-presubmit="_willSendRequest"
。iron-form-response
来调用_didReceiveResponse
。// this.$.checkoutForm.submit();
您可以将操作网址更改为您的php文件名。