2013-07-25 11:10
浏览 65


I'm using Symfony2 but i'm experiencing a troubling thing.

I have a form, with a textarea field, but each time i press 'enter' to go to the next line it refresh the page (without deleting the previous line)..

Do you have any idea where does it come from?


图片转代码服务由CSDN问答提供 功能建议



Do 你知道它来自哪里吗?


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • donglan9517 2013-07-25 11:23

    Well for sure you have a submit button on the form. On enter in a form you call the submit butt that refreshes the page!

    In order to prevent that you can just make the button in the type="button" and bind a onclick function so that the submit button is not called on enter!

    However; you will remove the enter feature that calls the submit on the entire form not just in the text area!

    OR --> you can just call a function on keypres or keyup on the text area and e.prevetnDefault();

    I hope my answers helps you!

    点赞 打赏 评论

相关推荐 更多相似问题