Php 验证文本区域
除了我的文本区域之外,所有其他表单元素都有效。思考一下为什么使用下面的代码Php 验证文本区域,php,jquery,codeigniter,Php,Jquery,Codeigniter,除了我的文本区域之外,所有其他表单元素都有效。思考一下为什么使用下面的代码 <?php $attributes = array('cols' => '30', 'rows' => '5', 'id' => 'article', 'class' => 'required') ?> <div> <?php echo form_textarea('article', '', $attributes); ?> </div
<?php $attributes = array('cols' => '30', 'rows' => '5', 'id' => 'article', 'class' => 'required') ?>
<div>
<?php echo form_textarea('article', '', $attributes); ?>
</div>
编辑:
我正在使用jQuery验证类
<div class="section _100">
<label for="article">Article</label>
<div>
<textarea name="article" cols="40" rows="10" Array></textarea>
</div>
</div>
文章
所以现在我想知道为什么它在完成类部分的属性放置时会显示这样的数组。当您传递属性数组时,它应该是唯一的
表单文本区域
函数。尝试以下操作:
<?php $attributes = array('name' => 'article', 'cols' => '30', 'rows' => '5', 'id' => 'article', 'class' => 'required') ?>
<div>
<?php echo form_textarea($attributes); ?>
</div>
当您传递属性数组时,它应该是唯一的
form\u textarea
函数。请尝试以下操作:
<?php $attributes = array('name' => 'article', 'cols' => '30', 'rows' => '5', 'id' => 'article', 'class' => 'required') ?>
<div>
<?php echo form_textarea($attributes); ?>
</div>
根据,您可以通过将名称和属性值作为两个参数传递或将所有属性作为数组作为单个参数传递来生成文本区域
请注意,在您的代码中有第三个参数。它是为其他数据保留的,如JavaScript。它只是作为字符串附加在textarea
标记中-这就是您看到Array
的原因
像这样创建您的文本区域
,但在$attributes
数组中包含您的姓名:
$attributes = array(
'name' => 'article',
'cols' => '30',
'rows' => '5',
'id' => 'article',
'class' => 'required'
);
echo form_textarea($attributes);
根据,您可以通过将名称和属性值作为两个参数传递或将所有属性作为数组作为单个参数传递来生成textarea
请注意,在您的代码中有第三个参数。它是为其他数据保留的,如JavaScript。它只是作为字符串附加在textarea
标记中-这就是您看到Array
的原因
像这样创建您的文本区域
,但在$attributes
数组中包含您的姓名:
$attributes = array(
'name' => 'article',
'cols' => '30',
'rows' => '5',
'id' => 'article',
'class' => 'required'
);
echo form_textarea($attributes);
请发布您的验证规则和逻辑。对不起,这是为了jqueryThen发布您的实际HTML以及您正在使用的任何jQuery验证逻辑。无法说出您发布的代码有什么问题。请发布您的验证规则和逻辑。对不起,这是为了jqueryThen发布您的实际HTML以及任何jQuery valida你正在使用的逻辑。不可能说出你发布的代码有什么问题。