Форма торта php не представлена - PullRequest
0 голосов
/ 06 сентября 2018

Я работаю над этим два дня назад, и я не нахожу ничего, что решило бы мою проблему:

У меня есть приложение php торт, в данном случае это форма, проблема с кнопкой отправки (действие), когда форма пуста, отправка работает, потому что я делаю дамп в контроллере, и я вижу пустой запрос, но когда я вставляю информацию во входные данные формы, кнопка отправки не работает, щелчок ничего не делает.

Представление: create_account.ctp

<?php
$this->assign('title', 'Crear una cuenta | Qualtrium');
?>

<div class="navigation">
    <div class="navigation-inner" style="display:block;">
        <div class="navigation-content"></div>
        <ul class="nav nav-tabs" role="tablist">
            <li role="presentation" class="active">
                <a href="#step1" data-toggle="tab" aria-controls="step1" role="tab" title="Step 1" data-step="1">
                    Información General
                </a>
            </li>

            <li role="presentation" class="disabled">
                <a href="#step2" data-toggle="tab" aria-controls="step2" role="tab" title="Step 2" data-step="2">
                    Convenio de confidencialidad
                </a>
            </li>
        </ul>
    </div>
    <?= $this->Form->create("/investorsAccount", ['id' => 'investorsAccount', 'class' => 'clswizard_form']) ?>
    <div class="tab-content">
        <div class="tab-pane active" role="tabpanel" id="step1">
            <div class="clsintro_main_content_blk">
                <div class="clswizard_form_blk clsgeneral_info_blk">
                    <div class="clsintro_img_blk visible-xs">
                        <figure><?php echo $this->Html->image('info_img1.png', [ 'width' => '445', 'alt' => '', 'class' => 'img-responsive']); ?></figure>
                    </div>
                    <?= $this->Form->input('language', ['type' => 'hidden', 'value' => ($this->request->controller == "Homes") ? 0 : 1, 'id' => 'language']); ?>
                    <div class="clsintro_main_content_blk">
                        <div class="clswizard_form_blk clsgeneral_info_blk clssales_blk clsinvestors_blk">
                            <div class="row">
                                <div class="col-md-6 col-sm-6 col-md-push-6 col-sm-push-6">
                                    <h1 class="visible-xs">Información general</h1>
                                    <div class="clsstructure_img_blk">
                                        <figure><?php echo $this->Html->image('general_info_new_img.png', ['width' => '500', 'alt' => '', 'class' => 'img-responsive']); ?></figure>
                                    </div>
                                </div>
                                <div class="col-md-6 col-sm-6 col-md-pull-6 col-sm-pull-6">
                                    <div class="clsstructure_blk">
                                        <h1 class="hidden-xs">Información general</h1>
                                        <div class="form-group">
                                            <?= $this->Form->input('email', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'email', 'class' => 'form-control', 'id' => 'email', 'placeholder' => '', 'label' => 'Email', 'autocomplete' => 'off']) ?>
                                        </div>
                                        <div class="form-group">
                                            <?= $this->Form->input('password', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'password', 'class' => 'form-control', 'id' => 'password', 'placeholder' => '', 'label' => 'Contraseña', 'autocomplete' => 'off']) ?>
                                        </div>
                                        <div class="form-group">
                                            <?= $this->Form->input('name', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'text', 'class' => 'form-control', 'placeholder' => '', 'label' => 'Nombre del Fondo / Banco', 'autocomplete' => 'off']) ?>
                                        </div>

                                        <div class="form-group">
                                            <?= $this->Form->input('website', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'text', 'class' => 'form-control', 'id' => 'website', 'placeholder' => '', 'label' => 'Sitio web', 'autocomplete' => 'off']) ?>
                                        </div>

                                        <div class="form-group">
                                            <div class="clslist_sort">
                                                <?php $types = [0 => 'Search Fund', 1 => 'Venture Capital', 2 => 'Private Equity', 3 => 'Private Credit', 4 => 'Family Office', 5 => 'Real Estate', 6 => 'Otro']; ?>
                                                <?= $this->Form->input('type', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'select', 'class' => 'required-entry validate-select selectpicker show-menu-arrow', 'options' => $types, 'id' => 'type', 'label' => 'Tipo']) ?>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <?= $this->Form->input('fund_size', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'text', 'class' => 'form-control', 'placeholder' => '', 'label' => 'Tamaño del fondo (millones de pesos)', 'autocomplete' => 'off']) ?>
                                        </div>
                                        <div class="form-group">
                                            <div class="clslist_sort">
                                                <?= $this->Form->input('location', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'select', 'class' => 'required-entry validate-select selectpicker show-menu-arrow', 'options' => $states, 'label' => 'Ubicación']) ?>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label>Fundado en</label>
                                            <div class="clslist_sort">
                                                <?= $this->Form->year('founded_in', [ 'minYear' => 1920, 'maxYear' => date('Y'), 'empty' => false, 'class' => 'required-entry validate-select selectpicker show-menu-arrow', 'id' => 'founded-in']) ?>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <div class="clslist_sort">
                                                <?= $this->Form->input('managing_directors', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'text', 'class' => 'form-control', 'placeholder' => '', 'label' => 'Socios Directores', 'autocomplete' => 'off']) ?>
                                            </div>
                                        </div> 
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                <h1 class="hidden-xs" style="padding-left: 15px">Tésis de inversión</h1>
                                <div class="col-md-6 col-sm-6">
                                    <h1 class="visible-xs">Tésis de inversión</h1>
                                    <div class="clsstructure_img_blk">
                                        <figure><?php echo $this->Html->image('thesis_img.png', ['width' => '450', 'alt' => '', 'class' => 'img-responsive']); ?></figure>
                                    </div>
                                </div>
                                <div class="col-md-6 col-sm-6">
                                    <div class="clsstructure_blk ls">
                                        <div class="form-group">
                                            <?= $this->Form->input('average_ticket_size', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'text', 'class' => 'form-control', 'id' => 'average_ticket', 'placeholder' => '', 'label' => 'Monto promedio de inversión (millones de pesos)', 'autocomplete' => 'off']) ?>
                                        </div>
                                        <div class="form-group">
                                            <div class="clslist_sort">
                                                <?php $options = [0 => 'Menos de $100', 1 => '$100 - $250', 2 => '$250 - $500', 3 => '$500 - $1,000', 4 => '$1,000 - $5,000', 5 => 'Más de $5,000']; ?>
                                                <?= $this->Form->input('range_of_sales', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'select', 'multiple' => true, 'class' => 'required-entry validate-select selectpicker show-menu-arrow', 'options' => $options, 'label' => 'Rango de Ventas de Empresas Objetivo (en millones de pesos):']) ?>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="clslist_sort">
                                                <?= $this->Form->input('target_industries', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'select', 'multiple' => true, 'class' => 'required-entry validate-select selectpicker show-menu-arrow', 'options' => $industries, 'label' => 'Industrias objetivo']) ?>
                                            </div>
                                        </div>
                                        <div class="form-group" style="height: 30px">
                                            <div class="other_industry">
                                                <?= $this->Form->input('other_industry', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'text', 'class' => 'form-control', 'placeholder' => 'Por favor ingrese la opción que falta', 'label' => false, 'autocomplete' => 'off']) ?>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="clslist_sort">
                                                <?php $strakes = [0 => 'Posición de Control', 1 => 'Posición Minoritaria']; ?>
                                                <?= $this->Form->input('desired_stake', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'select', 'multiple' => true, 'class' => 'required-entry validate-select selectpicker show-menu-arrow', 'options' => $strakes, 'label' => 'Objetivo de participación']) ?>
                                            </div>
                                        </div>

                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-6 col-sm-6 col-md-push-6 col-sm-push-6">
                                    <h1 class="visible-xs">Portafolio actual</h1>
                                    <div class="clsstructure_img_blk">
                                        <figure><?php echo $this->Html->image('holding_img.png', ['width' => '450', 'alt' => '', 'class' => 'img-responsive']); ?></figure>
                                    </div>
                                </div>
                                <div class="col-md-6 col-sm-6 col-md-pull-6 col-sm-pull-6">
                                    <div class="clsstructure_blk">
                                        <h1 class="hidden-xs">Portafolio actual</h1>
                                        <div class="form-group">
                                            <div class="clslist_sort">
                                                <?= $this->Form->input('experience_in', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'select', 'multiple' => true, 'class' => 'required-entry validate-select selectpicker show-menu-arrow', 'options' => $industries, 'label' => 'Experiencia en']) ?>
                                            </div>
                                        </div>
                                        <div class="form-group" style="height: 30px">
                                            <div class="other_option">
                                                <?= $this->Form->input('other_option', ['templates' => [ 'inputContainer' => '{{content}}'], 'type' => 'text', 'class' => 'form-control', 'placeholder' => 'Por favor ingrese la opción que falta', 'label' => false, 'autocomplete' => 'off']) ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="clsdouble_btns text-center">
                        <a href="javascript:void(0)" class="btn btn-success clsgreen_btn next-step-investor">Siguiente</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="tab-pane" role="tabpanel" id="step2">
            <div class="clsintro_main_content_blk">
                <section class="clsnda_section">
                    <?= $this->element('nda_spanish'); ?>
                    <div class="clsdouble_btns text-center clsnda_double_btns">
                        <a href="javascript:void(0)" class="btn btn-default clsblack_btn prev-step">Atrás</a>
                            <span id="ndanext_btn">
                                <button type="submit" class="btn btn-success clsgreen_btn clsnda_green_opa_btn">Finalizar</button>
                            </span>
                    </div>
                </section>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
    <?php echo $this->Form->end(); ?>
</div>

Функция в SpanishController.php

public function createAccount() {
        $this->loadModel('States');
        $this->loadModel('InvestorInfos');
        $states = $this->States->find('list', ['keyField' => 'name', 'valueField' => 'name'])->toArray();
        $industries = ['Agriculture and/or fishing' => 'Agricultura y/o Pesca', 'Beauty and personal care' => 'Belleza y Cuidado Personal', 'Caffe shops and ice cream parlors' => 'Cafeterías y Heladerías', 'Sports and/or fitness centers' => 'Deportes y/o Centros Fitness', 'Pharmaceutical (production)' => 'Farmacéutica (producción)', 'Pharmaceutical (distribution)' => 'Farmacéutica (distribución)', 'Software' => 'Software', 'Construction and/or maintenance' => 'Construcción y/o Mantenimiento', 'Education' => 'Educación', 'Energy' => 'Energía', 'Entertainment' => 'Entretenimiento', 'Financial services' => 'Servicios Financieros', 'Insurance' => 'Seguros', 'Food' => 'Alimentos', 'Beverages' => 'Bebidas', 'Health services' => 'Servicios de Salud', 'Hospitality (hotels, restaurants, tourism)' => 'Hospitalidad (hoteles, restaurantes, turismo)', 'Information technology and/or internet' => 'Tecnologías de la Información y/o Internet', 'Automotive' => 'Automotriz', 'Electronics manufacturing' => 'Manufactura de Electrónicos', 'Paper and pulp' => 'Papel y Pulpa', 'Steel' => 'Acero', 'Media' => 'Media', 'Mining' => 'Minería', 'Delivery and courier' => 'Mensajería y Paquetería', 'Telecommunications' => 'Telecomunicaciones', 'Transportation' => 'Transporte', 'Utilities (water, gas, electricity)' => 'Servicios Públicos (agua, gas, electricidad)', 'Textiles (apparel, shoes)' => 'Textiles (vestido, calzado)', 'Real Estate' => 'Inmobiliaria', 'Security services' => 'Seguridad', 'Retail' => 'Otros Comercios', 'Other' => 'Otra'];
        if ($this->request->is(['post'])) { //submit the form            
            $data = $this->request->data;
            debug($data);
            die;    
            $saveAccount = $this->Information->saveAccount($data);
            if ($saveAccount) {
                $this->request->session()->write('success', 'La información de los inversores se ha agregado con éxito.');
                return $this->redirect(['controller' => 'Spanish', 'action' => 'login']);
            }
            else{               
                debug($saveAccount);
                die;
            }

        }
        $this->set(compact('states', 'industries'));
        //Restrict for logged-in users and admin
        if ($this->Auth->user('website')) {
            return $this->redirect(['controller' => 'Spanish', 'action' => 'companyList']);
        }
    }

У меня есть валидатор jquery, но я думаю, что проблема не в моем скрипте js

jQuery(".next-step-investor").click(function (e) {
        e.preventDefault();
        //To view the page on top position
        jQuery(window).scrollTop(0);

        console.log($('#base_url').attr('rel') + 'homes/check_email' );

        /* Controller : Spanish Action : Create Account */
        jQuery("#investorsAccount").validate({
            ignore: ":hidden:not(select#experience-in,select#target-industries,select#desired-stake,select#range-of-sales)",
            rules: {
                email: {
                    requiredNotBlank: true,
                    email: true,
                    remote: {
                        url: $('#base_url').attr('rel') + 'homes/check_email',
                        type: 'post',
                        data: {
                            email: function () {
                                return $("#email").val();
                            }
                        }
                    }
                },
                password: {
                    requiredNotBlank: true,
                },
                name: {
                    requiredNotBlank: true,
                    charOnly: true,
                },
                website: {
                    required: true,
                },
                type: {
                    required: true,
                },
                fund_size: {
                    required: true,
                    number: true,
                    maxlength: 12,
                },
                location: {
                    required: true,
                },
                founded_in: {
                    required: true,
                },
                managing_directors: {
                    required: true,
                    charOnly: true,
                },
                average_ticket_size: {
                    required: true,
                    number: true,
                },
                'target_industries[]': {
                    required: true,
                },
                other_industry: {
                    required: function (element) {
                        return [$("#target-industries").val() == "Other" || $("#target-industries").val() == "Otra"];
                    }
                },
                'range_of_sales[]': {
                    required: true,
                },
                'desired_stake[]': {
                    required: true,
                },
                'experience_in[]': {
                    required: true,
                },
                other_option: {
                    required: function (element) {
                        return [$("#experience-in").val() == "Other" || $("#experience-in").val() == "Otra"];
                    }
                },
            },
            debug: true,
            messages: {
                email: {
                    remote: emailCheck
                }
            },
            invalidHandler: function (e, validator) {
                var errors = validator.numberOfInvalids();                
                if (errors) {
                    return false;
                }
                return true;
            }

        }).form();        
        if (jQuery("#investorsAccount").valid()) {
            var $active = $('.navigation .nav-tabs li.active');
            $active.next().removeClass('disabled');
            $active.next().find('a').css('pointer-events', 'auto');
            nextTab($active);            
        }
    });
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...