Sunday, May 19, 2013

Re: Error 406 - Not Acceptable with form

Changed to multipart/form-data   seems to solve issue.


On Sat, May 18, 2013 at 1:55 PM, rockbust <rockbust@optonline.net> wrote:

I have a form submit problem and looking for a solution.  Receiving a "406
Not Acceptable" when I submit my form.

I am passing a custom array that sometimes contains 100 or more users. The
admin needs to select all and register them.  As you can see when the form
is submitted there could be 1,000 separate elements in the form.
In doing a little research it seems it is possibly an issue with some
security feature of the server  (my xampp server does not return the error).
The hosting company is not very helpful.

Solutions please??
I have come up with one possible solution to paginate the array sent to the
view. That is a problem in itself because I am using a custom array that has
been manipulated to the max and can not find out how to paginate it? Second
this requires the admin to load the view and submit it maybe 20+ times to
register all users. Not a great option..

My form is set up as so.
admin_add_eligible:

<?php echo $this->Form->create('Testregistration', array('id' =>
'selectForm','action'=>'/add_eligible'));?>


                        Select All <input type="checkbox"
onclick="checkAll(document.getElementById('selectForm'), 'results1',
this.checked);" />
                        <?php echo 'First Name';?>
                        <?php echo 'Last Name';?>
                        <?php echo 'Next Rank';?>
                        <?php echo 'Attendances';?>
                        <?php echo 'Create Bill';?>
                        <?php echo 'Autopay';?>
                        <?php echo 'Bill Due Date';?>
                        <?php __('Actions');?>

        <?php
        $i = 0;
        if(!empty($eligibles)){
        foreach ($eligibles as $user):
        //debug($user);
                $class = null;
                if ($i++ % 2 == 0) {
                        $class = ' class="altrow"';
                }
        ?>
        <tr&lt;?php echo $class;?>>

                        <?php echo $this->Form->input('User.'.$user['user_id'].'.checked',
array('type'=>'checkbox', 'multiple' => 'checkbox', 'class' => 'results1',
'label'=>false, 'options' => array('Testregistration'.$user['user_id']
=>'Testregistration'.$user['user_id']))); ?>&nbsp;
                        <?php echo $user['first_name']; ?>&nbsp;
                        <?php echo $user['last_name']; ?>&nbsp;
                        <?php echo $user['rank_name']; ?>&nbsp;
                        <?php echo $user['attendance_numb']; ?>&nbsp;
                        <?php echo $this->Form->input('Bill.'.$user['user_id'].'.create_bill',
array('label' => false,'type'=>'checkbox','checked'=>true)); ?>&nbsp;
                        <?php echo $this->Form->input('Bill.'.$user['user_id'].'.auto_pay',
array('label' => false,'type'=>'checkbox')); ?>&nbsp;
                        <?php echo $this->Form->input('Bill.'.$user['user_id'].'.due_date',
array('label' => false ,'type'=>'date', 'dateFormat' => 'MDY')); ?>&nbsp;

                        <?php echo $this->Html->link(__('View', true), array('controller' =>
'users','action' => 'view', $user['user_id'])); ?>

                <?php //echo $this->Form->input('school_id', array( 'value' => 'hello' ,
'type' => 'hidden') );

echo $this->Form->input('Testregistration.'.$user['user_id'].'.program_id',
array( 'type' => 'hidden', 'value' =>  $user['program_id'] ));
echo $this->Form->input('Testregistration.'.$user['user_id'].'.old_rank_id',
array( 'type' => 'hidden', 'value' =>  $user['old_rank_id'] ));
echo $this->Form->input('Testregistration.'.$user['user_id'].'.fee', array(
'type' => 'hidden', 'value' =>  $user['fee'] ));
?>

<?php endforeach; ?>




--
View this message in context: http://cakephp.1045679.n5.nabble.com/Error-406-Not-Acceptable-with-form-tp5714980.html
Sent from the CakePHP mailing list archive at Nabble.com.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: