我如何“预先填写”?一个HTML表单中的textarea的值? [英] How can I "pre-fill" the value of a textarea in an HTML form?

查看:488
本文介绍了我如何“预先填写”?一个HTML表单中的textarea的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个简单的后端应用程序,用户可以通过该应用程序创建/更新/删除数据库行(在这种情况下,是作业列表)。 现在是用户编辑现有列表的时候了,我正试图用现有行中的数据预填大部分HTML表单。我已经成功地使用value属性为文本输入做好了准备,并且在每个选项标签中使用一些php进行选择:if([conditionforoption]){echo'selected'}。



我在预填充时遇到的输入类型是textarea ...关于如何在textarea输入中显示现有数据(长varchar字符串)时的任何想法加载页面?



如果可能的话,我试图远离JavaScript解决方案,但如果有必要,我会使用它。

解决方案

 < textarea>这是放置文本的地方。< / textarea> 


I'm creating a simple back-end app through which the user can create/update/delete database rows (in this case, job listings).

When it comes time for the user to edit an existing listing, I'm trying to pre-fill most of the HTML form with the data from that existing row. I've done this sucessfully for text inputs using the "value" property, and with selects using a bit of php in each option tag: if([conditionforoption]){echo'selected'}.

The input type that I'm having trouble pre-filling is the textarea... any thoughts on how to get the existing data (a long varchar string) to be present in the textarea input when the user loads the page?

I'm trying to stay away from a javascript solution if at all possible, but I'll use it if necessary.

解决方案

<textarea>This is where you put the text.</textarea>

这篇关于我如何“预先填写”?一个HTML表单中的textarea的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆