douchang6770
douchang6770
2012-12-31 11:50

如果其他字段存在验证错误消息,则输入值将转换为垃圾值

  • codeigniter
  • php
  • javascript
  • jquery

I am using following form but when I am submitting form without entering any mandatory fields, then in other input fields values are converting into garbage values.

<?php echo form_open_multipart($formAction); ?>

// form action is coming from controller

<div id="content">
    <table  border="0" cellpadding="0" cellspacing="5" width="100%" >
        <tr>         
            <td>First Name<em>*</em></td>
            <td>
                <?php
                $data = array('name' => 'firstName');
                echo form_input($data, $firstName);
                ?>
            </td>
        </tr>
        <tr>
            <td>Middle Name<em>*</em></td>
            <td>
                <?php
                $data = array('name' => 'middleName');
                echo form_input($data, $middleName);
                ?>
            </td>
        </tr>
        <tr>
            <td>Last Name<em>*</em></td>
            <td>
                <?php
                $data = array('name' => 'lastName');
                echo form_input($data, $lastName);
                ?>
            </td>
        </tr>  
        <tr>
            <td colspan="2">
                <div class="formbuttons">
                    <?php echo form_submit('submit', "Save", "class='button'"); ?>
                </div>
            </td>
        </tr>
    </table>
    <?php echo form_close(); ?>

If I enter "test's" in first name field and submit form without entering other mandatory fields then in First Name text box it is showing test&#39;s.

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐