最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

posts - HTML Form Submit to table in same page

programmeradmin4浏览0评论

I have the form and works fine. On submit I have no idea where the data is going. I want it to go into a table on the same page. What am I doing wrong?

<form id="myForm" action="" method="post" target="_parent">

<p>Date: 
  <input type="date" cf_name="Date" value="" maxlength="25" size="60">


Weight:
    <input type="text" cf_name="Weight" value="" maxlength="25" size="60">
</p>

<p>Comments:
    <input type="text" cf_name="comments" value="" maxlength="200" size="60">
</p>

<p>Insert Picture (optional):
    <input type="text" cf_name="pic1" value="" maxlength="200" size="60">
</p>


<p> 
  <input id="submit" type="button" value="Submit" cf_name="submit">
  <input type="button" cf_name="cancel" value="Cancel" onClick="closebox()">
</p>
</form>

<table id="details"></table>

I have the form and works fine. On submit I have no idea where the data is going. I want it to go into a table on the same page. What am I doing wrong?

<form id="myForm" action="" method="post" target="_parent">

<p>Date: 
  <input type="date" cf_name="Date" value="" maxlength="25" size="60">


Weight:
    <input type="text" cf_name="Weight" value="" maxlength="25" size="60">
</p>

<p>Comments:
    <input type="text" cf_name="comments" value="" maxlength="200" size="60">
</p>

<p>Insert Picture (optional):
    <input type="text" cf_name="pic1" value="" maxlength="200" size="60">
</p>


<p> 
  <input id="submit" type="button" value="Submit" cf_name="submit">
  <input type="button" cf_name="cancel" value="Cancel" onClick="closebox()">
</p>
</form>

<table id="details"></table>
Share Improve this question edited Nov 4, 2017 at 15:18 dealer58 asked Nov 4, 2017 at 13:18 dealer58dealer58 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 1

Couple of things with this. Your action attribute is empty. That's the attribute that tells the browser where to send the posted form data. Should be a field or if you're using AJAX, I always put # in there and let the javascript do it's thing.

Not sure about the cf_name attribute in your input fields. I seem to remember that might be an implementation of Adobe ColdFusion but it's certainly not HTML compliant.

发布评论

评论列表(0)

  1. 暂无评论