Form elements not being submitted











up vote
0
down vote

favorite












So I've got a weird problem that I'm having a hard time figuring out. I've got a simple form with a few elements that are not being submitted, all of these elements have only one thing in common, they're select elements:



            echo $this->Form->control("spirit_type_id", [
"label" => false,
"type" => "select",
"options" => $spirit_types,
"empty" => "Spirit Type"
]);

echo $this->Form->control("country_id", [
"label" => false,
"type" => "select",
"options" => $countries,
"empty" => "Country"
]);

echo $this->Form->control("region_id", [
"label" => false,
"type" => "select",
"options" => $regions,
"empty" => "Region"
]);


And in my controller I have:



public function add() {
$spirit = $this->Spirits->newEntity();
$spirit_types = $this->Spirits->SpiritTypes->find("list");
$countries = $this->Spirits->Countries->find("list");
$regions = $this->Spirits->Regions->find("list");

if ($this->request->is("post")) {
debug($this->request->getData());
die();
$spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
$spirit->user_id = $this->Auth->user("id");

if ($this->Spirits->save($spirit)) {
$this->Flash->success("Your spirit was successfully saved.");

$this->redirect(["action" => "index"]);
} else {
$this->Flash->error("Your spirit could not be saved.");
}

}

$this->set(compact("spirit", "spirit_types", "countries", "regions"));
}


The important part is that debug statement. It shows this when I insert data using the form.



[
'name' => 'Longrow Peated',
'image' => 'imageLocation',
'brand' => 'Springbank',
'age' => '',
'cost' => '55'
]


Those are all text and/or number elements in my form, and they all come out just fine. It gets a little weirder though. I have validation in my table to require those id fields:



public function validationDefault(Validator $validator) {
$validator->requirePresence(
"name", "brand", "spirit_type_id", "country_id", "region_id", "age", "cost", "image"
)
->notEmpty("name", "We require a name")
->notEmpty("brand", "We require a brand or distillery")
->notEmpty("spirit_type_id", "We require a type of alchohol")
->notEmpty("country_id", "We require a country of origin")


But this doesn't ever seem to get triggered when I insert the data using patchEntity, it's only caught when I actually call the save function and I try inserting into the database.










share|improve this question






















  • No chance you did something silly like close the form before you output those fields? They look fine. Check your browser console to look at exactly what data is being posted, to narrow down whether it's not being sent from the browser vs being lost somehow on the server side?
    – Greg Schmidt
    Nov 9 at 6:02












  • @GregSchmidt Yes the data being sent in the headers is the same as the data being displayed in the debug output. I've gone over the form and it's not being closed prematurely.
    – Arak Tai'Roth
    Nov 9 at 16:47










  • Well, the problem is pretty obviously in your form, I guess. Check the HTML of the page with a validator service to see if there's some problem? Even the DOM inspector built into most browsers might be able to show you. Or, if you can post the URL, people could look at it.
    – Greg Schmidt
    Nov 9 at 17:18










  • @GregSchmidt No errors using the W3C Validator. I have no URL to share, this is entirely on localhost for the time being.
    – Arak Tai'Roth
    Nov 10 at 9:21










  • @GregSchmidt Despite there being no errors, you were indeed correct. I had a couple custom form elements that I was using, and one of them was for select buttons. I was copying and pasting the original form elements and then just modifying them, but apparently I modified the name attribute out of it, and that's what did it. If you want to offer yours as an answer, I would be happy to accept it.
    – Arak Tai'Roth
    Nov 10 at 22:05















up vote
0
down vote

favorite












So I've got a weird problem that I'm having a hard time figuring out. I've got a simple form with a few elements that are not being submitted, all of these elements have only one thing in common, they're select elements:



            echo $this->Form->control("spirit_type_id", [
"label" => false,
"type" => "select",
"options" => $spirit_types,
"empty" => "Spirit Type"
]);

echo $this->Form->control("country_id", [
"label" => false,
"type" => "select",
"options" => $countries,
"empty" => "Country"
]);

echo $this->Form->control("region_id", [
"label" => false,
"type" => "select",
"options" => $regions,
"empty" => "Region"
]);


And in my controller I have:



public function add() {
$spirit = $this->Spirits->newEntity();
$spirit_types = $this->Spirits->SpiritTypes->find("list");
$countries = $this->Spirits->Countries->find("list");
$regions = $this->Spirits->Regions->find("list");

if ($this->request->is("post")) {
debug($this->request->getData());
die();
$spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
$spirit->user_id = $this->Auth->user("id");

if ($this->Spirits->save($spirit)) {
$this->Flash->success("Your spirit was successfully saved.");

$this->redirect(["action" => "index"]);
} else {
$this->Flash->error("Your spirit could not be saved.");
}

}

$this->set(compact("spirit", "spirit_types", "countries", "regions"));
}


The important part is that debug statement. It shows this when I insert data using the form.



[
'name' => 'Longrow Peated',
'image' => 'imageLocation',
'brand' => 'Springbank',
'age' => '',
'cost' => '55'
]


Those are all text and/or number elements in my form, and they all come out just fine. It gets a little weirder though. I have validation in my table to require those id fields:



public function validationDefault(Validator $validator) {
$validator->requirePresence(
"name", "brand", "spirit_type_id", "country_id", "region_id", "age", "cost", "image"
)
->notEmpty("name", "We require a name")
->notEmpty("brand", "We require a brand or distillery")
->notEmpty("spirit_type_id", "We require a type of alchohol")
->notEmpty("country_id", "We require a country of origin")


But this doesn't ever seem to get triggered when I insert the data using patchEntity, it's only caught when I actually call the save function and I try inserting into the database.










share|improve this question






















  • No chance you did something silly like close the form before you output those fields? They look fine. Check your browser console to look at exactly what data is being posted, to narrow down whether it's not being sent from the browser vs being lost somehow on the server side?
    – Greg Schmidt
    Nov 9 at 6:02












  • @GregSchmidt Yes the data being sent in the headers is the same as the data being displayed in the debug output. I've gone over the form and it's not being closed prematurely.
    – Arak Tai'Roth
    Nov 9 at 16:47










  • Well, the problem is pretty obviously in your form, I guess. Check the HTML of the page with a validator service to see if there's some problem? Even the DOM inspector built into most browsers might be able to show you. Or, if you can post the URL, people could look at it.
    – Greg Schmidt
    Nov 9 at 17:18










  • @GregSchmidt No errors using the W3C Validator. I have no URL to share, this is entirely on localhost for the time being.
    – Arak Tai'Roth
    Nov 10 at 9:21










  • @GregSchmidt Despite there being no errors, you were indeed correct. I had a couple custom form elements that I was using, and one of them was for select buttons. I was copying and pasting the original form elements and then just modifying them, but apparently I modified the name attribute out of it, and that's what did it. If you want to offer yours as an answer, I would be happy to accept it.
    – Arak Tai'Roth
    Nov 10 at 22:05













up vote
0
down vote

favorite









up vote
0
down vote

favorite











So I've got a weird problem that I'm having a hard time figuring out. I've got a simple form with a few elements that are not being submitted, all of these elements have only one thing in common, they're select elements:



            echo $this->Form->control("spirit_type_id", [
"label" => false,
"type" => "select",
"options" => $spirit_types,
"empty" => "Spirit Type"
]);

echo $this->Form->control("country_id", [
"label" => false,
"type" => "select",
"options" => $countries,
"empty" => "Country"
]);

echo $this->Form->control("region_id", [
"label" => false,
"type" => "select",
"options" => $regions,
"empty" => "Region"
]);


And in my controller I have:



public function add() {
$spirit = $this->Spirits->newEntity();
$spirit_types = $this->Spirits->SpiritTypes->find("list");
$countries = $this->Spirits->Countries->find("list");
$regions = $this->Spirits->Regions->find("list");

if ($this->request->is("post")) {
debug($this->request->getData());
die();
$spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
$spirit->user_id = $this->Auth->user("id");

if ($this->Spirits->save($spirit)) {
$this->Flash->success("Your spirit was successfully saved.");

$this->redirect(["action" => "index"]);
} else {
$this->Flash->error("Your spirit could not be saved.");
}

}

$this->set(compact("spirit", "spirit_types", "countries", "regions"));
}


The important part is that debug statement. It shows this when I insert data using the form.



[
'name' => 'Longrow Peated',
'image' => 'imageLocation',
'brand' => 'Springbank',
'age' => '',
'cost' => '55'
]


Those are all text and/or number elements in my form, and they all come out just fine. It gets a little weirder though. I have validation in my table to require those id fields:



public function validationDefault(Validator $validator) {
$validator->requirePresence(
"name", "brand", "spirit_type_id", "country_id", "region_id", "age", "cost", "image"
)
->notEmpty("name", "We require a name")
->notEmpty("brand", "We require a brand or distillery")
->notEmpty("spirit_type_id", "We require a type of alchohol")
->notEmpty("country_id", "We require a country of origin")


But this doesn't ever seem to get triggered when I insert the data using patchEntity, it's only caught when I actually call the save function and I try inserting into the database.










share|improve this question













So I've got a weird problem that I'm having a hard time figuring out. I've got a simple form with a few elements that are not being submitted, all of these elements have only one thing in common, they're select elements:



            echo $this->Form->control("spirit_type_id", [
"label" => false,
"type" => "select",
"options" => $spirit_types,
"empty" => "Spirit Type"
]);

echo $this->Form->control("country_id", [
"label" => false,
"type" => "select",
"options" => $countries,
"empty" => "Country"
]);

echo $this->Form->control("region_id", [
"label" => false,
"type" => "select",
"options" => $regions,
"empty" => "Region"
]);


And in my controller I have:



public function add() {
$spirit = $this->Spirits->newEntity();
$spirit_types = $this->Spirits->SpiritTypes->find("list");
$countries = $this->Spirits->Countries->find("list");
$regions = $this->Spirits->Regions->find("list");

if ($this->request->is("post")) {
debug($this->request->getData());
die();
$spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
$spirit->user_id = $this->Auth->user("id");

if ($this->Spirits->save($spirit)) {
$this->Flash->success("Your spirit was successfully saved.");

$this->redirect(["action" => "index"]);
} else {
$this->Flash->error("Your spirit could not be saved.");
}

}

$this->set(compact("spirit", "spirit_types", "countries", "regions"));
}


The important part is that debug statement. It shows this when I insert data using the form.



[
'name' => 'Longrow Peated',
'image' => 'imageLocation',
'brand' => 'Springbank',
'age' => '',
'cost' => '55'
]


Those are all text and/or number elements in my form, and they all come out just fine. It gets a little weirder though. I have validation in my table to require those id fields:



public function validationDefault(Validator $validator) {
$validator->requirePresence(
"name", "brand", "spirit_type_id", "country_id", "region_id", "age", "cost", "image"
)
->notEmpty("name", "We require a name")
->notEmpty("brand", "We require a brand or distillery")
->notEmpty("spirit_type_id", "We require a type of alchohol")
->notEmpty("country_id", "We require a country of origin")


But this doesn't ever seem to get triggered when I insert the data using patchEntity, it's only caught when I actually call the save function and I try inserting into the database.







cakephp cakephp-3.0






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 9 at 3:38









Arak Tai'Roth

301523




301523












  • No chance you did something silly like close the form before you output those fields? They look fine. Check your browser console to look at exactly what data is being posted, to narrow down whether it's not being sent from the browser vs being lost somehow on the server side?
    – Greg Schmidt
    Nov 9 at 6:02












  • @GregSchmidt Yes the data being sent in the headers is the same as the data being displayed in the debug output. I've gone over the form and it's not being closed prematurely.
    – Arak Tai'Roth
    Nov 9 at 16:47










  • Well, the problem is pretty obviously in your form, I guess. Check the HTML of the page with a validator service to see if there's some problem? Even the DOM inspector built into most browsers might be able to show you. Or, if you can post the URL, people could look at it.
    – Greg Schmidt
    Nov 9 at 17:18










  • @GregSchmidt No errors using the W3C Validator. I have no URL to share, this is entirely on localhost for the time being.
    – Arak Tai'Roth
    Nov 10 at 9:21










  • @GregSchmidt Despite there being no errors, you were indeed correct. I had a couple custom form elements that I was using, and one of them was for select buttons. I was copying and pasting the original form elements and then just modifying them, but apparently I modified the name attribute out of it, and that's what did it. If you want to offer yours as an answer, I would be happy to accept it.
    – Arak Tai'Roth
    Nov 10 at 22:05


















  • No chance you did something silly like close the form before you output those fields? They look fine. Check your browser console to look at exactly what data is being posted, to narrow down whether it's not being sent from the browser vs being lost somehow on the server side?
    – Greg Schmidt
    Nov 9 at 6:02












  • @GregSchmidt Yes the data being sent in the headers is the same as the data being displayed in the debug output. I've gone over the form and it's not being closed prematurely.
    – Arak Tai'Roth
    Nov 9 at 16:47










  • Well, the problem is pretty obviously in your form, I guess. Check the HTML of the page with a validator service to see if there's some problem? Even the DOM inspector built into most browsers might be able to show you. Or, if you can post the URL, people could look at it.
    – Greg Schmidt
    Nov 9 at 17:18










  • @GregSchmidt No errors using the W3C Validator. I have no URL to share, this is entirely on localhost for the time being.
    – Arak Tai'Roth
    Nov 10 at 9:21










  • @GregSchmidt Despite there being no errors, you were indeed correct. I had a couple custom form elements that I was using, and one of them was for select buttons. I was copying and pasting the original form elements and then just modifying them, but apparently I modified the name attribute out of it, and that's what did it. If you want to offer yours as an answer, I would be happy to accept it.
    – Arak Tai'Roth
    Nov 10 at 22:05
















No chance you did something silly like close the form before you output those fields? They look fine. Check your browser console to look at exactly what data is being posted, to narrow down whether it's not being sent from the browser vs being lost somehow on the server side?
– Greg Schmidt
Nov 9 at 6:02






No chance you did something silly like close the form before you output those fields? They look fine. Check your browser console to look at exactly what data is being posted, to narrow down whether it's not being sent from the browser vs being lost somehow on the server side?
– Greg Schmidt
Nov 9 at 6:02














@GregSchmidt Yes the data being sent in the headers is the same as the data being displayed in the debug output. I've gone over the form and it's not being closed prematurely.
– Arak Tai'Roth
Nov 9 at 16:47




@GregSchmidt Yes the data being sent in the headers is the same as the data being displayed in the debug output. I've gone over the form and it's not being closed prematurely.
– Arak Tai'Roth
Nov 9 at 16:47












Well, the problem is pretty obviously in your form, I guess. Check the HTML of the page with a validator service to see if there's some problem? Even the DOM inspector built into most browsers might be able to show you. Or, if you can post the URL, people could look at it.
– Greg Schmidt
Nov 9 at 17:18




Well, the problem is pretty obviously in your form, I guess. Check the HTML of the page with a validator service to see if there's some problem? Even the DOM inspector built into most browsers might be able to show you. Or, if you can post the URL, people could look at it.
– Greg Schmidt
Nov 9 at 17:18












@GregSchmidt No errors using the W3C Validator. I have no URL to share, this is entirely on localhost for the time being.
– Arak Tai'Roth
Nov 10 at 9:21




@GregSchmidt No errors using the W3C Validator. I have no URL to share, this is entirely on localhost for the time being.
– Arak Tai'Roth
Nov 10 at 9:21












@GregSchmidt Despite there being no errors, you were indeed correct. I had a couple custom form elements that I was using, and one of them was for select buttons. I was copying and pasting the original form elements and then just modifying them, but apparently I modified the name attribute out of it, and that's what did it. If you want to offer yours as an answer, I would be happy to accept it.
– Arak Tai'Roth
Nov 10 at 22:05




@GregSchmidt Despite there being no errors, you were indeed correct. I had a couple custom form elements that I was using, and one of them was for select buttons. I was copying and pasting the original form elements and then just modifying them, but apparently I modified the name attribute out of it, and that's what did it. If you want to offer yours as an answer, I would be happy to accept it.
– Arak Tai'Roth
Nov 10 at 22:05












2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










If $this->request->getData() is not showing all of your fields, the most likely cause would be some sort of problem with your form; there are not a lot of ways for CakePHP to discard your data from here. You can narrow it down by using browser tools (built into most of them now) to inspect the data actually being sent from your browser in the page request.



If it turns out that the fields really aren't being sent across at all, the problem is almost certainly in your form. For example, you might be closing it early, or there might be HTML errors that confuse the browser. Make sure that all of your input tags are between the <form> and </form>, and if they are then try an HTML validator to check your code. There are lots of options online, and even the inspectors built into browsers can often help you spot these sorts of issues.






share|improve this answer




























    up vote
    0
    down vote













    This is the most common problem:



    If you check debug($this->request->getData()); before $spirit = $this->Spirits->newEntity(); you then see all submitted data!



    Next go to Spirit Entity and double check if your fields "spirit_type_id,.." accessible!



    /**
    * Fields that can be mass assigned using newEntity() or patchEntity().
    *
    * Note that when '*' is set to true, this allows all unspecified fields to
    * be mass assigned. For security purposes, it is advised to set '*' to false
    * (or remove it), and explicitly make individual fields accessible as needed.
    *
    * @var array
    */
    protected $_accessible = [
    '*' => true, // quick fix
    'id' => false,
    ];


    or better way:



    protected $_accessible = [
    'spirit_type_id' => true,
    'country_id' => true,
    // etc ...
    ];


    Edit



    debug



    $spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
    debug($spirit); exit();


    see if any errors.






    share|improve this answer























    • Where I've got my debug statement currently is perfectly adequate to see all submitted data. I've also gone through my SpiritEntity and confirmed that all of these fields are accessible. Although that shouldn't play a part in where my issue is, the data just isn't being sent from the form period.
      – Arak Tai'Roth
      Nov 9 at 16:48










    • debug $spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
      – Salines
      Nov 9 at 16:53












    • no errors on debugging
      – Arak Tai'Roth
      Nov 10 at 9:13











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53219505%2fform-elements-not-being-submitted%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    If $this->request->getData() is not showing all of your fields, the most likely cause would be some sort of problem with your form; there are not a lot of ways for CakePHP to discard your data from here. You can narrow it down by using browser tools (built into most of them now) to inspect the data actually being sent from your browser in the page request.



    If it turns out that the fields really aren't being sent across at all, the problem is almost certainly in your form. For example, you might be closing it early, or there might be HTML errors that confuse the browser. Make sure that all of your input tags are between the <form> and </form>, and if they are then try an HTML validator to check your code. There are lots of options online, and even the inspectors built into browsers can often help you spot these sorts of issues.






    share|improve this answer

























      up vote
      1
      down vote



      accepted










      If $this->request->getData() is not showing all of your fields, the most likely cause would be some sort of problem with your form; there are not a lot of ways for CakePHP to discard your data from here. You can narrow it down by using browser tools (built into most of them now) to inspect the data actually being sent from your browser in the page request.



      If it turns out that the fields really aren't being sent across at all, the problem is almost certainly in your form. For example, you might be closing it early, or there might be HTML errors that confuse the browser. Make sure that all of your input tags are between the <form> and </form>, and if they are then try an HTML validator to check your code. There are lots of options online, and even the inspectors built into browsers can often help you spot these sorts of issues.






      share|improve this answer























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        If $this->request->getData() is not showing all of your fields, the most likely cause would be some sort of problem with your form; there are not a lot of ways for CakePHP to discard your data from here. You can narrow it down by using browser tools (built into most of them now) to inspect the data actually being sent from your browser in the page request.



        If it turns out that the fields really aren't being sent across at all, the problem is almost certainly in your form. For example, you might be closing it early, or there might be HTML errors that confuse the browser. Make sure that all of your input tags are between the <form> and </form>, and if they are then try an HTML validator to check your code. There are lots of options online, and even the inspectors built into browsers can often help you spot these sorts of issues.






        share|improve this answer












        If $this->request->getData() is not showing all of your fields, the most likely cause would be some sort of problem with your form; there are not a lot of ways for CakePHP to discard your data from here. You can narrow it down by using browser tools (built into most of them now) to inspect the data actually being sent from your browser in the page request.



        If it turns out that the fields really aren't being sent across at all, the problem is almost certainly in your form. For example, you might be closing it early, or there might be HTML errors that confuse the browser. Make sure that all of your input tags are between the <form> and </form>, and if they are then try an HTML validator to check your code. There are lots of options online, and even the inspectors built into browsers can often help you spot these sorts of issues.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 12 at 14:52









        Greg Schmidt

        2,5551725




        2,5551725
























            up vote
            0
            down vote













            This is the most common problem:



            If you check debug($this->request->getData()); before $spirit = $this->Spirits->newEntity(); you then see all submitted data!



            Next go to Spirit Entity and double check if your fields "spirit_type_id,.." accessible!



            /**
            * Fields that can be mass assigned using newEntity() or patchEntity().
            *
            * Note that when '*' is set to true, this allows all unspecified fields to
            * be mass assigned. For security purposes, it is advised to set '*' to false
            * (or remove it), and explicitly make individual fields accessible as needed.
            *
            * @var array
            */
            protected $_accessible = [
            '*' => true, // quick fix
            'id' => false,
            ];


            or better way:



            protected $_accessible = [
            'spirit_type_id' => true,
            'country_id' => true,
            // etc ...
            ];


            Edit



            debug



            $spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
            debug($spirit); exit();


            see if any errors.






            share|improve this answer























            • Where I've got my debug statement currently is perfectly adequate to see all submitted data. I've also gone through my SpiritEntity and confirmed that all of these fields are accessible. Although that shouldn't play a part in where my issue is, the data just isn't being sent from the form period.
              – Arak Tai'Roth
              Nov 9 at 16:48










            • debug $spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
              – Salines
              Nov 9 at 16:53












            • no errors on debugging
              – Arak Tai'Roth
              Nov 10 at 9:13















            up vote
            0
            down vote













            This is the most common problem:



            If you check debug($this->request->getData()); before $spirit = $this->Spirits->newEntity(); you then see all submitted data!



            Next go to Spirit Entity and double check if your fields "spirit_type_id,.." accessible!



            /**
            * Fields that can be mass assigned using newEntity() or patchEntity().
            *
            * Note that when '*' is set to true, this allows all unspecified fields to
            * be mass assigned. For security purposes, it is advised to set '*' to false
            * (or remove it), and explicitly make individual fields accessible as needed.
            *
            * @var array
            */
            protected $_accessible = [
            '*' => true, // quick fix
            'id' => false,
            ];


            or better way:



            protected $_accessible = [
            'spirit_type_id' => true,
            'country_id' => true,
            // etc ...
            ];


            Edit



            debug



            $spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
            debug($spirit); exit();


            see if any errors.






            share|improve this answer























            • Where I've got my debug statement currently is perfectly adequate to see all submitted data. I've also gone through my SpiritEntity and confirmed that all of these fields are accessible. Although that shouldn't play a part in where my issue is, the data just isn't being sent from the form period.
              – Arak Tai'Roth
              Nov 9 at 16:48










            • debug $spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
              – Salines
              Nov 9 at 16:53












            • no errors on debugging
              – Arak Tai'Roth
              Nov 10 at 9:13













            up vote
            0
            down vote










            up vote
            0
            down vote









            This is the most common problem:



            If you check debug($this->request->getData()); before $spirit = $this->Spirits->newEntity(); you then see all submitted data!



            Next go to Spirit Entity and double check if your fields "spirit_type_id,.." accessible!



            /**
            * Fields that can be mass assigned using newEntity() or patchEntity().
            *
            * Note that when '*' is set to true, this allows all unspecified fields to
            * be mass assigned. For security purposes, it is advised to set '*' to false
            * (or remove it), and explicitly make individual fields accessible as needed.
            *
            * @var array
            */
            protected $_accessible = [
            '*' => true, // quick fix
            'id' => false,
            ];


            or better way:



            protected $_accessible = [
            'spirit_type_id' => true,
            'country_id' => true,
            // etc ...
            ];


            Edit



            debug



            $spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
            debug($spirit); exit();


            see if any errors.






            share|improve this answer














            This is the most common problem:



            If you check debug($this->request->getData()); before $spirit = $this->Spirits->newEntity(); you then see all submitted data!



            Next go to Spirit Entity and double check if your fields "spirit_type_id,.." accessible!



            /**
            * Fields that can be mass assigned using newEntity() or patchEntity().
            *
            * Note that when '*' is set to true, this allows all unspecified fields to
            * be mass assigned. For security purposes, it is advised to set '*' to false
            * (or remove it), and explicitly make individual fields accessible as needed.
            *
            * @var array
            */
            protected $_accessible = [
            '*' => true, // quick fix
            'id' => false,
            ];


            or better way:



            protected $_accessible = [
            'spirit_type_id' => true,
            'country_id' => true,
            // etc ...
            ];


            Edit



            debug



            $spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
            debug($spirit); exit();


            see if any errors.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 9 at 16:57

























            answered Nov 9 at 16:35









            Salines

            2,95931134




            2,95931134












            • Where I've got my debug statement currently is perfectly adequate to see all submitted data. I've also gone through my SpiritEntity and confirmed that all of these fields are accessible. Although that shouldn't play a part in where my issue is, the data just isn't being sent from the form period.
              – Arak Tai'Roth
              Nov 9 at 16:48










            • debug $spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
              – Salines
              Nov 9 at 16:53












            • no errors on debugging
              – Arak Tai'Roth
              Nov 10 at 9:13


















            • Where I've got my debug statement currently is perfectly adequate to see all submitted data. I've also gone through my SpiritEntity and confirmed that all of these fields are accessible. Although that shouldn't play a part in where my issue is, the data just isn't being sent from the form period.
              – Arak Tai'Roth
              Nov 9 at 16:48










            • debug $spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
              – Salines
              Nov 9 at 16:53












            • no errors on debugging
              – Arak Tai'Roth
              Nov 10 at 9:13
















            Where I've got my debug statement currently is perfectly adequate to see all submitted data. I've also gone through my SpiritEntity and confirmed that all of these fields are accessible. Although that shouldn't play a part in where my issue is, the data just isn't being sent from the form period.
            – Arak Tai'Roth
            Nov 9 at 16:48




            Where I've got my debug statement currently is perfectly adequate to see all submitted data. I've also gone through my SpiritEntity and confirmed that all of these fields are accessible. Although that shouldn't play a part in where my issue is, the data just isn't being sent from the form period.
            – Arak Tai'Roth
            Nov 9 at 16:48












            debug $spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
            – Salines
            Nov 9 at 16:53






            debug $spirit = $this->Spirits->patchEntity($spirit, $this->request->getData());
            – Salines
            Nov 9 at 16:53














            no errors on debugging
            – Arak Tai'Roth
            Nov 10 at 9:13




            no errors on debugging
            – Arak Tai'Roth
            Nov 10 at 9:13


















             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53219505%2fform-elements-not-being-submitted%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            鏡平學校

            ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

            Why https connections are so slow when debugging (stepping over) in Java?