I have a form, with some fields. When i try save, not happens and I don´t know what´s the problem.
How can i see whats happening on the save moment ?!
Thanks you!.
These are the most likely causes for a failed save:
incorrect data array structure, debug data passed for saving
failing validation, debug($this->SomeModel->validationErrors) after save
beforeSave/beforeValidate callback in model or attached behavior not returning true
sql error, turn up debug to 2
Anywhere in your view file, you get the errors like this :
<?php debug($this->AnyModel->validationErrors);?>
Aside from debugging, you display field-by-field error like this :
<?php $this->Form->error('fieldname'); ?>
This will return the message from validation rules, only if the field has thrown an error.
Hope this helps!
Related
I dont get an error while coding but I do get an error while running in eclipse java.
I select the data from the table and then update checkbox using checkbox.setSelected(true) and it errors out.
is there any better way in Java to resolve this issue please.
Thanks
I tried saving the selected data into a variable and printed the variable and it
shows the right data but while I try to change the status of the checkbox, I get an
error.
Trying to do something which is very simple but am getting strange results.
I have an image stored as an attachment which I want to display in a VF Page.
If I do this it works fine
<apex:image url="{!URLFOR($Action.Attachment.Download,'00PR0000008Q3YmMAK')}"/>
However that was for testing purposes that I hardcoded the id. If I try reference the Id in the object then it fails. Even though the value contained in the object is exactly the same as above.
<apex:image url="{!URLFOR($Action.Attachment.Download,model.PreviewImageAttachId)}"/>
When I load the page I get an error in URLFOR param!!!
I thought my problem was because model.PreviewImageAttachId was a String and not an Id so I created a wrapper to return it as an Id - same error.
I then decided Salesforce must have some strange requirement that you can only pass in the REAL object so I did that and passed in model.Attach.Id and it still fails!!
Please can someone explain this to me and more importantly suggest a solution??!?
Once again if I output to the page
{!model.PreviewImageAttachId} i get 00PR0000008Q3YmMAK
So I just cant explain this!
Thanks!
My bad...
Was using apex:repeat and turns out SOME of the id values were null.
Hence the error
According to the section 'The Controller-View Relationship' located in http://www.recessframework.org/page/controlling-the-controller :
Try removing the body of the printIt method and refresh to get an error indicating no view template at 'helloWorld/views/printIt.php' can be found.
I tried this and upon refreshing the page, saw []. I checked the response header and it was of type application/json. Could this have something to do with it? I've tried installing Recess on another machine and it resulted in the same behavior.
Can someone tell me how to get an error???
if i have a cake php saveAll method like so:
if ($this->Video->saveAll($this->data)){
... // stuff that never happens, sadly
} else {
...
$this->Session->setFlash('boo! hss! error here');
}
how do i print out the database error? I tried:
$this->Session->setFlash('boo! hss! error here' . print_r($this->Video->validationErrors,true);
but that didn't work (it just showed me an empty array)
cheerio!
UPDATE:
ah. So, the problem is that, while normally i'd get the database error, i was using the old prg mechanism, and cake doesn't (magically) show the db errors on redirect pages.
Fair enough, but in the future, how the heck am i meant to see the db errors on a redirect page (that is, the question still stands, its just that most people probably just SEE the error, and don't need to do anything to get it)
make sure debug is set to 2 in config/core.php
print error messages to the log file like so:
$this->log(print_r($this->Video->validationErrors, true));
I am facing a strange problem in cakePHP.
The issue is when ever i submitted a form it results a blank screen.
before submission the action work fine.
Do any body have any idea on this issue.
Thanks in advance
There are a few things to help you check what is happening.
1- Check config/core.php and set DEBUG to 2. If you are getting a blank screen, this may not do anything.
2- Check your controllers / models. Make sure there is no blank lines after the ending ?> php tag. This could also cause blank screens.
3- Check syntax of your code. Try commenting out code to see if there is some code that may be improperly formed causing syntactical outages.
You can try posting your code so we can take a look. Maybe we can eyeball what is occurring.