CAKE PHP中的表单元素验证错误

时间:2014-04-16 13:18:07

标签: php cakephp

我是蛋糕php的新手。我正在使用getlancer脚本。我想在项目页面中添加一个新字段。该字段是一个日期选择器。日期选择器工作正常,但是在页面发布时,日期选择器的选定日期未传递给控制器​​。

获取错误消息:模型代码中定义的必需11。

日期选择器元素创建代码:

<div class="input text date-time select required validation:     {'message':'Required','allowEmpty':false,'rule':'notempty'}">
    <div class="js-datetime">
        <div class="js-cake-date">
        <?php echo $this->Form-input('pickupdate', array('label' => __l('Pick up date'), 'type' => 'date')); ?>
    </div>
    </div>
</div>

型号代码:

Array (
    'pickupdate' => array(
        'rule1' => array(
        'rule' => 'notempty',
        'message' => __l('Required11')
    ) ,
    'rule2' => array(
        'rule' => 'date',
        'message' => __l('Must be a valid date')
    )
)

控制器代码:

$this->request->data['Project']['pickupdate'] = $this->request->data['Project']['pickupdate'];

数据库表:

Field Name: pickupdate
Type: Date
Null: Yes
Default: Null

为元素呈现HTML:

<div class=”input text date-time select required validation:{'message':'Required','allowEmpty':false,'rule':'notempty'}”>

<div data-displayed="true" class="js-datetime xltriggered">
<div style="display: none;" class="js-cake-date">
<div class="input date required validation:{'rule2':{'rule':'date','message':'Must be a valid date'},'rule1':    {'rule':'empty','message':'Required11'}}"><label for="ProjectPickupdateMonth">Pick up date</label>    <select name="data[Project][pickupdate][month]" id="ProjectPickupdateMonth">
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04" selected="selected">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>-<select name="data[Project][pickupdate][day]" id="ProjectPickupdateDay">
<option value="01">1</option>
<option value="02">2</option>
<option value="03">3</option>
<option value="04">4</option>
<option value="05">5</option>
<option value="06">6</option>
<option value="07">7</option>
<option value="08">8</option>
<option value="09">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16" selected="selected">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>-<select name="data[Project][pickupdate][year]" id="ProjectPickupdateYear">
<option value="2034">2034</option>
<option value="2033">2033</option>
<option value="2032">2032</option>
<option value="2031">2031</option>
<option value="2030">2030</option>
<option value="2029">2029</option>
<option value="2028">2028</option>
<option value="2027">2027</option>
<option value="2026">2026</option>
<option value="2025">2025</option>
<option value="2024">2024</option>
<option value="2023">2023</option>
<option value="2022">2022</option>
<option value="2021">2021</option>
<option value="2020">2020</option>
<option value="2019">2019</option>
<option value="2018">2018</option>
<option value="2017">2017</option>
<option value="2016">2016</option>
<option value="2015">2015</option>
<option value="2014" selected="selected">2014</option>
<option value="2013">2013</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
<option value="2005">2005</option>
<option value="2004">2004</option>
<option value="2003">2003</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<option value="2000">2000</option>
<option value="1999">1999</option>
<option value="1998">1998</option>
<option value="1997">1997</option>
<option value="1996">1996</option>
<option value="1995">1995</option>
<option value="1994">1994</option>
</select></div>                     </div>
<div id="datetimepicker1" class="input-append date datetimepicker"><input value="2014-04-17-19-01-PM" type="hidden"><label for="Pick up date">Pick up date</label><span class="add-onn top-smspace js-calender-block hor-space show-inline cur"><i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar text-16"></i> <span class="js-display-date">Apr 17, 2014</span></span><span class="info"></span></div></div></div>

完整表格代码:add.ctp(如有必要)

<?php /* SVN: $Id: $ */ ?>
<div class="js-validation-part">

  <div class="projects form js-responses">
  <section class="row ver-space ver-smspace">
<?php if (!(isset($this->request->params['prefix']) and $this->request->params['prefix'] ==     'admin')) {?>
      <div class="tab-head bot-mspace text-13 clearfix"><h2 class="pull-left text-16 no-mar"><?php echo $this->Html->eAlt(ConstAltVerb::SingularCaps).' Control Panel';?></h2>
    <?php echo $this->element('employer-menu'); ?>
  </div>
<?php }?>

<h3 class="grayc"><?php echo __l('Post your project');?> </h3>

<?php echo $this->Form->create('Project', array('class' => 'form-horizontal js-upload-form', 'enctype' => 'multipart/form-data'));?>
    <fieldset>
        <h3 class="tab-head text-16 textn img-rounded"><?php echo __l('Type');?></h3>
        <div class="input radio radio-active-style top-mspace left-space">
            <?php  echo $this->Form->input('project_type_id', array('legend' => false,'type' => 'radio','class'=>'js-online','div' =>false));?>
            <div class="ver-space">
                <span class="help-block no-mar"><?php echo __l('Online:').' '.$this->Html->eAlt(ConstAltVerb::SingularCaps).' '.__l('or').' '.$this->Html->fAlt(ConstAltVerb::SingularSmall).' '.__l('can accomplish his/her job completely over net'); ?></span>
                <span class="help-block no-mar"> <?php echo __l('Offline:').' '.$this->Html->eAlt(ConstAltVerb::SingularCaps).' '.__l('or').' '.$this->Html->fAlt(ConstAltVerb::SingularSmall).' '.__l('needs to physically interact with each other'); ?></span>
            </div>
        </div>
    </fieldset>

    <fieldset>
    <?php
            if($this->Auth->user('role_id') == ConstUserTypes::Admin){
                echo $this->Form->input('user_id', array('label' => $this->Html->eAlt(ConstAltVerb::SingularCaps), 'empty' => __l('Please Select')));
            } ?>
        <h3 class="tab-head text-16 textn img-rounded"><?php echo __l('Info');?></h3>
        <div class="input text required ver-space">
          <?php echo $this->Form->input('name', array('label' => __l('Project Name'))); ?>
        </div>
        <div class="input textarea required">
          <?php echo $this->Form->input('description', array('type'=>'textarea','class' => 'js-description-count {"display":"js-description","field":"js-description-count","count":"'.Configure::read('Project.project_max_description_length').'"}','label'=>__l('Description'),'info'=>__l('Do not post any contact info. You can communicate with').' '.$this->Html->fAlt(ConstAltVerb::PluralCaps).' '.__l('on your project message board.').' <span class="character-info">'.__l('You have').' <span id="js-description-count"></span> '.__l('characters left').'</span>'));?>
         </div>
    </fieldset>
    <?php if(isPluginEnabled('ProjectCategory')): ?>
    <fieldset>
    <h3 class="tab-head text-16 textn img-rounded"><?php echo __l('Opportunity Type');?></h3>
    <div class="input select ver-space required validation:{'message':'Required','allowEmpty':false,'rule':'numeric'}">
      <?php echo $this->Form->input('project_category_id',array('multiple' => '','label' =>  __l('Opportunity Type'),'class'=>'span10','empty' => __l('Please Select')));?>

    <?php if(!empty($error)){?>
            <div class="error-message"><?php echo __l('Required'); ?></div>
        <?php } ?>
    </fieldset>
    <?php endif;?>
    <fieldset>

    <h3 class="tab-head text-16 textn img-rounded"><?php echo __l('Location');?></h3>
    <div class="mapblock-info">
        <div class="clearfix address-input-block">
        <?php
            echo $this->Form->input('address', array('type'=>'text','label' => __l('Address'), 'id' => 'ProjectAddress','class'=>'js-offline address-error-message')); ?>
        </div>
        <?php   echo $this->Form->input('latitude', array('id' => 'latitude', 'type' => 'hidden'));
            echo $this->Form->input('longitude', array('id' => 'longitude', 'type' => 'hidden'));
            echo $this->Form->input('country_id',array('class'=>'js-address','id'=>'js-country_id','type' => 'hidden'));
            echo $this->Form->input('State.name', array('type' => 'hidden'));
            echo $this->Form->input('City.name', array('type' => 'hidden'));
        ?>
        <div id="address-info" class="hide"><?php echo __l('Please select correct address value'); ?></div>
        <div id="mapblock">
            <div id="mapframe">
                <div id="mapwindow"></div>
            </div>
        </div>
    </div>
    </fieldset>
    <fieldset>
        <h3 class="tab-head text-16 textn img-rounded"><?php echo __l('Range');?></h3>
        <div class="input select required ver-space">
            <?php
            echo $this->Form->input('project_range_id', array('label' => __l('Project Budget'),'empty' => __l('Please Select')));
            $class='';
            if (empty($this->request->data['Project']['project_range_id']) || (!empty($this->request->data['Project']['project_range_id']) &&       $this->request->data['Project']['project_range_id'] !='custom')):
                $class ='hide';
            endif;
        ?>
        </div>
        <div class="input text required">
            <div class="<?php echo $class; ?> js-budget">
            <?php
                if(Configure::read('site.currency_symbol_place') == 'left'):
                    $currecncy_place = 'between';
                else:
                    $currecncy_place = 'after';
                endif;  
            ?>  
                <?php
                    echo $this->Form->input('ProjectRange.min_amount', array('label' => __l('Min amount') . ' (' . Configure::read('site.currency') . ')'));
                    echo $this->Form->input('ProjectRange.max_amount', array('label' => __l('Max amount') . ' (' . Configure::read('site.currency') . ')'));
                ?>
            </div>
            <?php echo $this->Form->input('bid_duration', array('label' => __l('Bidding Duration'),'info'  =>  __l('Maximum Bid Duration: ').Configure::read('Project.max_bid_duration') . ' days')); ?>
        </div>
            <div class="input text date-time select required validation:{'message':'Required','allowEmpty':false,'rule':'notempty'}">
                <div class="js-datetime">
                    <div class="js-cake-date">
                                <?php echo $this->Form->input('pickupdate', array('label' => __l('Pick up date'), 'type' => 'date')); ?>
                    </div>
                </div>
            </div>
    </fieldset>
    <fieldset>

    <h3 class="tab-head text-16 textn img-rounded"> <?php echo __l('Vehicle Type');?></h3>
    <div class="input select no-mar js-remove-error-skill required">
        <div class="clearfix skills-block">
            <?php echo $this->Form->input('skill_id',array('multiple' => '', 'options'=>$Skill, 'label' => __l('Vehicle Type'), 'empty' => __l('Please Select'),'class'=>'span10')); ?>
        </div>

    </div>
    <?php if(!empty($error)){?>
            <div class="error-message"><?php echo __l('Required'); ?></div>
        <?php }?>
    </fieldset>
    <fieldset>

    <h3 class="tab-head text-16 textn img-rounded"><?php echo __l('Attachment');?></h3>
    <div class="input file no-mar ver-space">
      <?php    
      echo $this->Form->input('Attachment.filename', array('type' => 'file', 'size' => '33', 'label' => __l('Upload File'), 'class' => "browse-field js-remove-error"));?>
    </div>
    </fieldset>
    <fieldset>
    <?php if(Configure::read('Project.is_enable_project_options')) { ?><legend><?php echo __l('Options');?></legend> <?php } ?>
    <?php   
    $total_fee = $list_fee = Configure::read('project.listing_fee');
    echo $this->Form->input('listing_fee', array('type' => 'hidden', 'id'=> 'js_project_listing_fee',  'value' => $list_fee));
    ?>
    <div class="alert alert-info bot-mspace"><i class="icon-info-sign"></i>
        <?php if(!empty($list_fee)){
            echo __l('Listing Fee'). ' (' . Configure::read('site.currency') . $list_fee . ')';
         } else{
            echo __l('Listing fee is free');
         } ?>
    </div>
    <?php
        if(isPluginEnabled('Projects')){
            if(Configure::read('Project.is_enable_project_options')) {?>
    <div class="input checkbox no-mar">
        <div class="span8 no-mar">



                     <span class="show space">
                     <?php $featured_fee = Configure::read('Project.featured_fee') ?  ' (' . Configure::read('site.currency') . Configure::read('Project.featured_fee') . ')' : '';
                        if(!empty($this->request->data['Project']['is_featured'])){
                        $total_fee += Configure::read('Project.featured_fee');
                        } ?>
                     <?php echo $this->Form->input('is_featured', array('label' => __l('Featured').$featured_fee, 'div'=>false, 'class'=>"js-payment-show {'amount':'".Configure::read('Project.featured_fee')."'}"));?>
                     <span class="info no-mar"><i class="icon-info-sign"></i>Featured projects will be displayed on top.</span>
                     </span>
                     <span class="js-job space">
                        <?php $job_listing_fee = Configure::read('Project.job_listing_fee') ?  ' (' . Configure::read('site.currency') . Configure::read('Project.job_listing_fee') . ')' : '';
                        echo $this->Form->input('is_job_listing', array('label' => __l('Job Listing').$job_listing_fee , 'div'=>false, 'class'=>"js-payment-show js-show {'container':'js-job_listing','amount':'".Configure::read('Project.job_listing_fee')."'}")); ?>
                        <span class="info left-mspace"><i class="icon-info-sign"></i>Displayed as job.</span>
                     </span>


                    <?php
                    $job_listing_class= empty($this->request->data['Project']['is_job_listing']) ? 'hide js-clone' : '';
                    if(!empty($this->request->data['Project']['is_job_listing'])){
                        $total_fee += Configure::read('Project.job_listing_fee');
                    }
                    ?>
                    <div class="<?php echo $job_listing_class; ?> js-job_listing">
                     <span class="show space">
                        <?php
                             echo $this->Form->input('salary_type_id',array('label'=>'Salary type','empty'=>__l('Select')));  
                             echo $this->Form->input('salary',array('label'=>'Salary (' . Configure::read('site.currency') . ')' ));
                             echo $this->Form->input('contact_info');  
                        ?>
                     </span>
                    </div>

                      <span class="show space">
                         <?php $urgent_fee = Configure::read('Project.urgent_fee') ?  ' (' . Configure::read('site.currency') . Configure::read('Project.urgent_fee') . ')' : '';

                        if(!empty($this->request->data['Project']['is_urgent'])){
                            $total_fee += Configure::read('Project.urgent_fee');
                        }

                        echo $this->Form->input('is_urgent', array('label' => __l('Mark Project Urgent').$urgent_fee,  'div'=>false, 'class'=>"js-payment-show {'amount':'".Configure::read('Project.urgent_fee')."'}"));?>
                        <span class="info no-mar"><i class="icon-info-sign"></i>Project will be marked as urgent, and displayed on top(Next to the featured projects).</span>
                        </span>

                            <?php $private_fee = Configure::read('Project.private_project_fee') ?  ' (' . Configure::read('site.currency') . Configure::read('Project.private_project_fee') . ')' : '';
                            //  echo $this->Form->input('is_private', array('label' => __l('Private Project').$private_fee, 'class'=>"js-payment-show js-show {'container':'js-programmer-list','amount':'".Configure::read('Project.private_project_fee')."'}"));

                            $freelancer_class= empty($this->request->data['Project']['is_private']) ? 'hide' : '';
                            ?>
                            <div class="<?php echo $freelancer_class; ?> js-programmer-list">
                                <span class="show space"><?php
                                echo $this->Form->autocomplete('projectuser', array('label' => $this->Html->fAlt(ConstAltVerb::PluralCaps), 'acFieldKey' => 'User.id', 'acMultiple' => true, 'acFields' => array('User.username'), 'acSearchFieldNames' => array('User.username'), 'maxlength' => '255'));?>
                                <span class="info"> <?php echo __l('This is visible only for the selected').' '.$this->Html->fAlt(ConstAltVerb::PluralSmall); ?></span>
                                <?php echo $this->Form->input('type',array('type'=>'hidden','value'=>'freelancers','id'=>'userType'));
                                ?></span>
                            </div>

                        <span class="show space">
                            <div class="js-hidden_bid">
                                <?php
                                    $hidden_bid_fee = Configure::read('Project.hidden_bid_fee') ?  ' (' . Configure::read('site.currency') . Configure::read('Project.hidden_bid_fee') . ')' : '';?>
                                        <?php  echo $this->Form->input('is_hidded_bid', array('label' => __l('Hide My Bids').$hidden_bid_fee,  'div'=>false, 'class'=>"js-payment-show js-bids-hide {'amount':'".Configure::read('Project.hidden_bid_fee')."'}"));
                                    $pre_paid_fee = Configure::read('Project.pre_paid_fee') ?  ' (' . Configure::read('site.currency') . Configure::read('Project.pre_paid_fee') . ')' : '';
                                    //echo $this->Form->input('is_pre_paid', array('label' => __l('Pre Paid Project').$pre_paid_fee, 'class'=>"js-payment-show {'amount':'".Configure::read('Project.pre_paid_fee')."'}"));
                                ?>
                                <span class="info no-mar"><i class="icon-info-sign"></i>Bids on the project will be hide.</span>
                           </div>
                          </span>

       </div>
    </div>
    <?php } } ?>
    <dl class="well bot-mspace space no-shad no-bor clearfix">
      <dt class="pull-left text-14 textb"><?php echo __l('Total Payment');?></dt>
      <dd class="pull-right text-16 textb greenc"><?php if(Configure::read('Project.is_enable_project_options')) { echo Configure::read('site.currency'); } ?><span class="js-total"><?php echo $this->Html->siteCurrencyFormat($this->Html->cCurrency($total_fee)); ?></span></dd>
    </dl>
    </fieldset>
    <?php                
            foreach($gateway_options as $key => $gateway_option){                
                if($key==ConstPaymentGateways::Wallet){
                    $gateway_option=$gateway_option . ' ('.__l('Current Balance ') . Configure::read('site.currency') . $user_available_balance . ')';
                }
                    $gateways[$key]=$gateway_option;                        
            }?>


    <div class="well no-bor no-shad clearfix">
      <div class="submit pull-right no-mar">
        <?php echo $this->Form->submit(__l('Post'), array('id' => 'js-project-add-id',"class"=>"btn space span3 no-mar","div"=>false)); ?>
      </div>
    </div>
<?php echo $this->Form->end();?>
</section>
  </div>
</div>

3 个答案:

答案 0 :(得分:2)

这里有两件事。 1.确保使用

在视图或元素ctp文件中打开表单
<?php echo $this->Form->create('Project'); ?>
  1. 如果你的日期选择器是一个javascript驱动的日期选择器,它可能会以某种方式干扰你的字段或字段名称。页面渲染后,查看源代码并查看原始字段发生了什么。如果通过'datepicker'表示默认HTML选择了蛋糕生成,那么考虑到上述情况,它应该都有效。

  2. 您还可以使用$ this-&gt; Form-&gt; end()检查您是否正确关闭了表单,我错过了一次并且表单没有正确发布。

答案 1 :(得分:1)

您的验证规则编码不完整。你错过了一个支架 -

这应该看起来像 -

Array (
    'pickupdate' => array(
        'rule1' => array(
            'rule' => 'notEmpty',
            'message' => __l('Required11')
        ) ,
        'rule2' => array(
            'rule' => 'date',
            'message' => __l('Must be a valid date')
        )
    )// you miss that..
)

答案 2 :(得分:0)

完整表格代码:add.ctp(查看表格)

<?php /* SVN: $Id: $ */ ?>
<div class="js-validation-part">

  <div class="projects form js-responses">
  <section class="row ver-space ver-smspace">
<?php if (!(isset($this->request->params['prefix']) and $this->request->params['prefix'] ==     'admin')) {?>
      <div class="tab-head bot-mspace text-13 clearfix"><h2 class="pull-left text-16 no-mar"><?php echo $this->Html->eAlt(ConstAltVerb::SingularCaps).' Control Panel';?></h2>
    <?php echo $this->element('employer-menu'); ?>
  </div>
<?php }?>

<h3 class="grayc"><?php echo __l('Post your project');?> </h3>

<?php echo $this->Form->create('Project', array('class' => 'form-horizontal js-upload-form', 'enctype' => 'multipart/form-data'));?>
    <fieldset>
        <h3 class="tab-head text-16 textn img-rounded"><?php echo __l('Type');?></h3>
        <div class="input radio radio-active-style top-mspace left-space">
            <?php  echo $this->Form->input('project_type_id', array('legend' => false,'type' => 'radio','class'=>'js-online','div' =>false));?>
            <div class="ver-space">
                <span class="help-block no-mar"><?php echo __l('Online:').' '.$this->Html->eAlt(ConstAltVerb::SingularCaps).' '.__l('or').' '.$this->Html->fAlt(ConstAltVerb::SingularSmall).' '.__l('can accomplish his/her job completely over net'); ?></span>
                <span class="help-block no-mar"> <?php echo __l('Offline:').' '.$this->Html->eAlt(ConstAltVerb::SingularCaps).' '.__l('or').' '.$this->Html->fAlt(ConstAltVerb::SingularSmall).' '.__l('needs to physically interact with each other'); ?></span>
            </div>
        </div>
    </fieldset>

    <fieldset>
    <?php
            if($this->Auth->user('role_id') == ConstUserTypes::Admin){
                echo $this->Form->input('user_id', array('label' => $this->Html->eAlt(ConstAltVerb::SingularCaps), 'empty' => __l('Please Select')));
            } ?>
        <h3 class="tab-head text-16 textn img-rounded"><?php echo __l('Info');?></h3>
        <div class="input text required ver-space">
          <?php echo $this->Form->input('name', array('label' => __l('Project Name'))); ?>
        </div>
        <div class="input textarea required">
          <?php echo $this->Form->input('description', array('type'=>'textarea','class' => 'js-description-count {"display":"js-description","field":"js-description-count","count":"'.Configure::read('Project.project_max_description_length').'"}','label'=>__l('Description'),'info'=>__l('Do not post any contact info. You can communicate with').' '.$this->Html->fAlt(ConstAltVerb::PluralCaps).' '.__l('on your project message board.').' <span class="character-info">'.__l('You have').' <span id="js-description-count"></span> '.__l('characters left').'</span>'));?>
         </div>
    </fieldset>
    <?php if(isPluginEnabled('ProjectCategory')): ?>
    <fieldset>
    <h3 class="tab-head text-16 textn img-rounded"><?php echo __l('Opportunity Type');?></h3>
    <div class="input select ver-space required validation:{'message':'Required','allowEmpty':false,'rule':'numeric'}">
      <?php echo $this->Form->input('project_category_id',array('multiple' => '','label' =>  __l('Opportunity Type'),'class'=>'span10','empty' => __l('Please Select')));?>

    <?php if(!empty($error)){?>
            <div class="error-message"><?php echo __l('Required'); ?></div>
        <?php } ?>
    </fieldset>
    <?php endif;?>
    <fieldset>

    <h3 class="tab-head text-16 textn img-rounded"><?php echo __l('Location');?></h3>
    <div class="mapblock-info">
        <div class="clearfix address-input-block">
        <?php
            echo $this->Form->input('address', array('type'=>'text','label' => __l('Address'), 'id' => 'ProjectAddress','class'=>'js-offline address-error-message')); ?>
        </div>
        <?php   echo $this->Form->input('latitude', array('id' => 'latitude', 'type' => 'hidden'));
            echo $this->Form->input('longitude', array('id' => 'longitude', 'type' => 'hidden'));
            echo $this->Form->input('country_id',array('class'=>'js-address','id'=>'js-country_id','type' => 'hidden'));
            echo $this->Form->input('State.name', array('type' => 'hidden'));
            echo $this->Form->input('City.name', array('type' => 'hidden'));
        ?>
        <div id="address-info" class="hide"><?php echo __l('Please select correct address value'); ?></div>
        <div id="mapblock">
            <div id="mapframe">
                <div id="mapwindow"></div>
            </div>
        </div>
    </div>
    </fieldset>
    <fieldset>
        <h3 class="tab-head text-16 textn img-rounded"><?php echo __l('Range');?></h3>
        <div class="input select required ver-space">
            <?php
            echo $this->Form->input('project_range_id', array('label' => __l('Project Budget'),'empty' => __l('Please Select')));
            $class='';
            if (empty($this->request->data['Project']['project_range_id']) || (!empty($this->request->data['Project']['project_range_id']) &&       $this->request->data['Project']['project_range_id'] !='custom')):
                $class ='hide';
            endif;
        ?>
        </div>
        <div class="input text required">
            <div class="<?php echo $class; ?> js-budget">
            <?php
                if(Configure::read('site.currency_symbol_place') == 'left'):
                    $currecncy_place = 'between';
                else:
                    $currecncy_place = 'after';
                endif;  
            ?>  
                <?php
                    echo $this->Form->input('ProjectRange.min_amount', array('label' => __l('Min amount') . ' (' . Configure::read('site.currency') . ')'));
                    echo $this->Form->input('ProjectRange.max_amount', array('label' => __l('Max amount') . ' (' . Configure::read('site.currency') . ')'));
                ?>
            </div>
            <?php echo $this->Form->input('bid_duration', array('label' => __l('Bidding Duration'),'info'  =>  __l('Maximum Bid Duration: ').Configure::read('Project.max_bid_duration') . ' days')); ?>
        </div>
            <div class="input text date-time select required validation:{'message':'Required','allowEmpty':false,'rule':'notempty'}">
                <div class="js-datetime">
                    <div class="js-cake-date">
                                <?php echo $this->Form->input('pickupdate', array('label' => __l('Pick up date'), 'type' => 'date')); ?>
                    </div>
                </div>
            </div>
    </fieldset>
    <fieldset>

    <h3 class="tab-head text-16 textn img-rounded"> <?php echo __l('Vehicle Type');?></h3>
    <div class="input select no-mar js-remove-error-skill required">
        <div class="clearfix skills-block">
            <?php echo $this->Form->input('skill_id',array('multiple' => '', 'options'=>$Skill, 'label' => __l('Vehicle Type'), 'empty' => __l('Please Select'),'class'=>'span10')); ?>
        </div>

    </div>
    <?php if(!empty($error)){?>
            <div class="error-message"><?php echo __l('Required'); ?></div>
        <?php }?>
    </fieldset>
    <fieldset>

    <h3 class="tab-head text-16 textn img-rounded"><?php echo __l('Attachment');?></h3>
    <div class="input file no-mar ver-space">
      <?php    
      echo $this->Form->input('Attachment.filename', array('type' => 'file', 'size' => '33', 'label' => __l('Upload File'), 'class' => "browse-field js-remove-error"));?>
    </div>
    </fieldset>
    <fieldset>
    <?php if(Configure::read('Project.is_enable_project_options')) { ?><legend><?php echo __l('Options');?></legend> <?php } ?>
    <?php   
    $total_fee = $list_fee = Configure::read('project.listing_fee');
    echo $this->Form->input('listing_fee', array('type' => 'hidden', 'id'=> 'js_project_listing_fee',  'value' => $list_fee));
    ?>
    <div class="alert alert-info bot-mspace"><i class="icon-info-sign"></i>
        <?php if(!empty($list_fee)){
            echo __l('Listing Fee'). ' (' . Configure::read('site.currency') . $list_fee . ')';
         } else{
            echo __l('Listing fee is free');
         } ?>
    </div>
    <?php
        if(isPluginEnabled('Projects')){
            if(Configure::read('Project.is_enable_project_options')) {?>
    <div class="input checkbox no-mar">
        <div class="span8 no-mar">



                     <span class="show space">
                     <?php $featured_fee = Configure::read('Project.featured_fee') ?  ' (' . Configure::read('site.currency') . Configure::read('Project.featured_fee') . ')' : '';
                        if(!empty($this->request->data['Project']['is_featured'])){
                        $total_fee += Configure::read('Project.featured_fee');
                        } ?>
                     <?php echo $this->Form->input('is_featured', array('label' => __l('Featured').$featured_fee, 'div'=>false, 'class'=>"js-payment-show {'amount':'".Configure::read('Project.featured_fee')."'}"));?>
                     <span class="info no-mar"><i class="icon-info-sign"></i>Featured projects will be displayed on top.</span>
                     </span>
                     <span class="js-job space">
                        <?php $job_listing_fee = Configure::read('Project.job_listing_fee') ?  ' (' . Configure::read('site.currency') . Configure::read('Project.job_listing_fee') . ')' : '';
                        echo $this->Form->input('is_job_listing', array('label' => __l('Job Listing').$job_listing_fee , 'div'=>false, 'class'=>"js-payment-show js-show {'container':'js-job_listing','amount':'".Configure::read('Project.job_listing_fee')."'}")); ?>
                        <span class="info left-mspace"><i class="icon-info-sign"></i>Displayed as job.</span>
                     </span>


                    <?php
                    $job_listing_class= empty($this->request->data['Project']['is_job_listing']) ? 'hide js-clone' : '';
                    if(!empty($this->request->data['Project']['is_job_listing'])){
                        $total_fee += Configure::read('Project.job_listing_fee');
                    }
                    ?>
                    <div class="<?php echo $job_listing_class; ?> js-job_listing">
                     <span class="show space">
                        <?php
                             echo $this->Form->input('salary_type_id',array('label'=>'Salary type','empty'=>__l('Select')));  
                             echo $this->Form->input('salary',array('label'=>'Salary (' . Configure::read('site.currency') . ')' ));
                             echo $this->Form->input('contact_info');  
                        ?>
                     </span>
                    </div>

                      <span class="show space">
                         <?php $urgent_fee = Configure::read('Project.urgent_fee') ?  ' (' . Configure::read('site.currency') . Configure::read('Project.urgent_fee') . ')' : '';

                        if(!empty($this->request->data['Project']['is_urgent'])){
                            $total_fee += Configure::read('Project.urgent_fee');
                        }

                        echo $this->Form->input('is_urgent', array('label' => __l('Mark Project Urgent').$urgent_fee,  'div'=>false, 'class'=>"js-payment-show {'amount':'".Configure::read('Project.urgent_fee')."'}"));?>
                        <span class="info no-mar"><i class="icon-info-sign"></i>Project will be marked as urgent, and displayed on top(Next to the featured projects).</span>
                        </span>

                            <?php $private_fee = Configure::read('Project.private_project_fee') ?  ' (' . Configure::read('site.currency') . Configure::read('Project.private_project_fee') . ')' : '';
                            //  echo $this->Form->input('is_private', array('label' => __l('Private Project').$private_fee, 'class'=>"js-payment-show js-show {'container':'js-programmer-list','amount':'".Configure::read('Project.private_project_fee')."'}"));

                            $freelancer_class= empty($this->request->data['Project']['is_private']) ? 'hide' : '';
                            ?>
                            <div class="<?php echo $freelancer_class; ?> js-programmer-list">
                                <span class="show space"><?php
                                echo $this->Form->autocomplete('projectuser', array('label' => $this->Html->fAlt(ConstAltVerb::PluralCaps), 'acFieldKey' => 'User.id', 'acMultiple' => true, 'acFields' => array('User.username'), 'acSearchFieldNames' => array('User.username'), 'maxlength' => '255'));?>
                                <span class="info"> <?php echo __l('This is visible only for the selected').' '.$this->Html->fAlt(ConstAltVerb::PluralSmall); ?></span>
                                <?php echo $this->Form->input('type',array('type'=>'hidden','value'=>'freelancers','id'=>'userType'));
                                ?></span>
                            </div>

                        <span class="show space">
                            <div class="js-hidden_bid">
                                <?php
                                    $hidden_bid_fee = Configure::read('Project.hidden_bid_fee') ?  ' (' . Configure::read('site.currency') . Configure::read('Project.hidden_bid_fee') . ')' : '';?>
                                        <?php  echo $this->Form->input('is_hidded_bid', array('label' => __l('Hide My Bids').$hidden_bid_fee,  'div'=>false, 'class'=>"js-payment-show js-bids-hide {'amount':'".Configure::read('Project.hidden_bid_fee')."'}"));
                                    $pre_paid_fee = Configure::read('Project.pre_paid_fee') ?  ' (' . Configure::read('site.currency') . Configure::read('Project.pre_paid_fee') . ')' : '';
                                    //echo $this->Form->input('is_pre_paid', array('label' => __l('Pre Paid Project').$pre_paid_fee, 'class'=>"js-payment-show {'amount':'".Configure::read('Project.pre_paid_fee')."'}"));
                                ?>
                                <span class="info no-mar"><i class="icon-info-sign"></i>Bids on the project will be hide.</span>
                           </div>
                          </span>

       </div>
    </div>
    <?php } } ?>
    <dl class="well bot-mspace space no-shad no-bor clearfix">
      <dt class="pull-left text-14 textb"><?php echo __l('Total Payment');?></dt>
      <dd class="pull-right text-16 textb greenc"><?php if(Configure::read('Project.is_enable_project_options')) { echo Configure::read('site.currency'); } ?><span class="js-total"><?php echo $this->Html->siteCurrencyFormat($this->Html->cCurrency($total_fee)); ?></span></dd>
    </dl>
    </fieldset>
    <?php                
            foreach($gateway_options as $key => $gateway_option){                
                if($key==ConstPaymentGateways::Wallet){
                    $gateway_option=$gateway_option . ' ('.__l('Current Balance ') . Configure::read('site.currency') . $user_available_balance . ')';
                }
                    $gateways[$key]=$gateway_option;                        
            }?>


    <div class="well no-bor no-shad clearfix">
      <div class="submit pull-right no-mar">
        <?php echo $this->Form->submit(__l('Post'), array('id' => 'js-project-add-id',"class"=>"btn space span3 no-mar","div"=>false)); ?>
      </div>
    </div>
<?php echo $this->Form->end();?>
</section>
  </div>
</div>