0

我试图弄清楚为什么我在控制台中收到此错误:未捕获的异常:无效的表格

当我加载页面时。

我相信导致它的原因是这个。我认为这是因为我一点一点地删除了,当我到达这部分时,它删除了我控制台中的错误。

<?php echo form_label('Booking Date', 'booking_date'); ?>
<?php 
$attributes = array(
'id' => 'datetime',
'name' => 'booking_date',
'class' => 'required hasDatepicker valid',
'type' => 'datetime',
'data-date-relative' => 'now' 
);
?>
<?php echo form_input($attributes); ?>

所有代码

<h2 class="grid_12">Book Event</h2>
<div class="clear"></div>
<div class="grid_12">
<div class="box wizard" data-step="1">
    <div class="header">
        <?php echo img('assets/peach/img/icons/packs/fugue/16x16/shadeless/application--arrow.png'); ?>
        <?php echo heading('Book Event', 3); ?>
        <span></span>
    </div>
    <div class="content with-actions">
        <div class="steps">
            <ul>
                <li class="current">
                    <a href="#step_1">
                        <span>1</span>
                        <div>
                            <strong>Book Event</strong>
                            <small></small>
                        </div>
                    </a>
                </li>
                <li>
                    <a href="#step_2">
                        <span>2</span>
                        <div>
                            <strong>Schedule Matches</strong>
                            <small></small>
                        </div>
                    </a>
                </li>
                <li>
                    <a href="#step_3">
                        <span>3</span>
                        <div>
                            <strong>Verify Event</strong>
                            <small></small>
                        </div>
                    </a>
                </li>
            </ul>
        </div>
        <div class="wiz_page step_1">
            <div class="wiz_sidebar grid_3">
                <span>1</span>
                <div>
                   <strong>Book Event</strong>
                   <small></small>
                </div>
                <p></p>
            </div>
            <div class="wiz_content grid_9">
                <h3>Event Setup</h3>
                <?php echo form_open('newevent'); ?>
                    <?php echo form_label('Event Name', 'event_name'); ?>
                    <?php 
                    $options = array();
                    $options['default'] = 'Please Select An Option';
                    foreach ( $event_names AS $name ) 
                    {
                        $options[$name->id] = $name->event_name;
                    }
                    ?>
                    <?php echo form_dropdown('eventname', $options, 'default'); ?>
                    <?php echo form_label('Event Label', 'event_label'); ?>
                    <?php echo form_input('event_label', ''); ?>
                    <?php echo form_label('Booking Date', 'booking_date'); ?>
                    <?php 
                    $attributes = array(
                        'id' => 'datetime',
                        'name' => 'booking_date',
                        'class' => 'required hasDatepicker valid',
                        'type' => 'datetime',
                        'data-date-relative' => 'now'
                    );
                    ?>
                    <?php print_r($attributes); ?>
                    <?php echo form_input($attributes); ?>
                    <?php echo form_label('Arena', 'arenas'); ?>
                    <?php 
                    $options = array();
                    $options['default'] = 'Please Select An Option';
                    foreach ( $arenas AS $arena )
                    {
                        $options[$arena->id] = $arena->arena_name;
                    }
                    ?>
                    <?php echo form_dropdown('arenas', $options, 'default'); ?>
                    <?php echo form_label('Introduction', 'introduction'); ?>
                    <?php echo form_textarea('introduction', ''); ?>
                <?php echo form_close(); ?>
            </div>
        </div>
    </div>
    <div class="actions">
        <div class="actions-left">
            <button class="prev">&laquo; Back</button>
        </div>
        <div class="actions-right">
            <button class="next">Forward &raquo;</button>
        </div>
    </div> <!-- End of .content -->
    <div class="clear"></div>
</div>
</div>

链接到实时页面:链接

4

1 回答 1

1

这是一个 JavaScript 错误,它源自以下代码段:

$.each(ids, function () {
    if (this.indexOf('dp') == 0 || $('label[for=' + this + ']').length) {
        id = this;
    }
});

if (!id) {
    throw "Invalid form";
}

如您所见,如果id计算结果为假,您将抛出“无效表单”异常。

于 2012-06-18T21:11:26.540 回答