SharePoint Online表单处理

时间:2015-09-25 18:09:42

标签: javascript html forms sharepoint sharepoint-online

我编写了一个简单的HTML / PHP表单,它从表单输出并输出到HTML以创建公司标准电子邮件签名。它只是将表单字段中的字符串回显到签名的HTML中。

形式:

<form action="sig.php" method="post">
Full Name: <input type="text" name="fullName"><br>
Job Title: <input type="text" name="jobTitle"><br>
Direct Phone Number (xxx.xxx.xxxx) <input type="text" name="phoneNumber"><br>
Email: <input type="text" name="email"><br>
<input type="submit">
</form>

PHP:

<div style="font-size:10pt; font-family:'Arial',sans-serif;color:#0E5881">
Please copy/paste the following into your email signature:
</div>
<hr>
<br>
<br>
<div style="font-size:12pt; font-family:'Arial',sans-serif;color:#133467">
<b><?php echo $_POST["fullName"]; ?></b>
</div>
<div style="font-size:10pt; font-family:'Arial',sans-serif;color:#0E5881">
<?php echo $_POST["jobTitle"]; ?>
</div>
<div style="font-size:10pt; font-family:'Arial',sans-serif;color:#656565">
Direct:</b>&nbsp;<?php echo $_POST["phoneNumber"]; ?>
<br>
<a href="mailto:<?php echo $_POST["email"]; ?>"><?php echo $_POST["email"]; ?></a>&nbsp;&#124;&nbsp;<a href="http://www.example.com">www.Example.com</a>
</div>
<br>
<div style="font-size:20pt; font-family:'Arial',sans-serif;color:#676767">
<b>Example.com</b>

效果很好,但现在他们告诉我他们想把它放在我们公司的SharePoint Online网站上。

据我所知,没有办法在SharePoint上运行PHP。我也无法使用PageViewer Web部件。

通过SharePoint执行此操作的最佳选择是什么?将在SharePoint内部运行的客户端?我认为Java Script是一种选择,但我对此一无所知。我知道SharePoint使用ASP,但我对此知之甚少。

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:1)

PHP是服务器端代码,除非您愿意编写自己的SharePoint应用程序,否则无法在SharePoint中添加。

对于这样的事情,你最好的选择可能只是一个带有一些JavaScript的页面。

&#13;
&#13;
document.getElementById("btnSubmit").addEventListener("click", function() {
  document.getElementById("signaturePanel").style.display = "inherit";
  document.getElementById("fullNameOut").innerHTML = document.getElementById("fullName").value;
  document.getElementById("jobTitleOut").innerHTML = document.getElementById("jobTitle").value;
  document.getElementById("phoneNumberOut").innerHTML = document.getElementById("phoneNumber").value;
  var email = document.getElementById("email").value;
  var emailOut = document.getElementById("emailOut");
  emailOut.innerHTML = email;
  emailOut.href = "mailto:" + email;
  document.getElementById("socialOut").style.display = document.getElementById("social").checked ? "inherit" : "none";
  
});
&#13;
Full Name:
<input type="text" id="fullName" />
<br>Job Title:
<input type="text" id="jobTitle" />
<br>Direct Phone Number (xxx.xxx.xxxx)
<input type="text" id="phoneNumber" />
<br>Email:
<input type="text" id="email" />
<br>
<input type="checkbox" id="social" checked="checked" />Include social media links
<br/>
<input type="button" id="btnSubmit" value="submit" />

<div id="signaturePanel" style="display:none">
  <div style="font-size:10pt; font-family:'Arial',sans-serif;color:#0E5881;">
    Please copy/paste the following into your email signature:
  </div>
  <hr>
  <br>
  <br>
  <div style="font-size:12pt; font-family:'Arial',sans-serif;color:#133467">
    <b><span id="fullNameOut"></span></b>
  </div>
  <div style="font-size:10pt; font-family:'Arial',sans-serif;color:#0E5881">
    <span id="jobTitleOut"></span>
  </div>
  <div style="font-size:10pt; font-family:'Arial',sans-serif;color:#656565">
    Direct:</b>&nbsp;<span id="phoneNumberOut"></span>
    <br>
    <a id="emailOut" href="mailto:"></a>&nbsp;&#124;&nbsp;<a href="http://www.example.com">www.Example.com</a>
  </div>
  <br>
  <div style="font-size:20pt; font-family:'Arial',sans-serif;color:#676767">
    <b>Example.com</b>
    <div id="socialOut" style="display:none">
      <a href="http://example.com">
        <img src="https://placeholdit.imgix.net/~text?txtsize=15&txt=twitter+link&w=90&h=90&txttrack=0" />
      </a>
    </div>
  </div>
&#13;
&#13;
&#13;