I digress - I got to work this morning and whatever was allowing it work last night has ceased to work today. The only way I can get this to work with the conditional in the handler method is to wrap it in a transaction. The form data is coming in via a post and everything checks out as far as the rc is concerned (the data is all there and accessible). Using the transaction I removed the project.save() to get it to work.
If I output the chain of execution when I call project.save() inside of the conditional (without the transaction) the method doesn’t appear to be firing. i.e. I placed a console dump inside the ActiveEntity’s save method and nothing ever makes it the console. Again - project.save() does work if the conditional isn’t present in the handler.
I also believe it has something to do with how the data is getting posted to the handler via the ajax post. But - conditional or not, hibernate successfully pulls the record from the database regardless of how the projectId is passed to the handler.
I am using windows 7 (IIS 7.5) with coldfusion 9.0.1 and the development branch of Coldbox. I did revert back to the 3.5 release earlier today with the same results.
I am at a total loss.
Here is the full working method as it stands right now.
function save(event, rc, prc) {
prc.results = validateModel(target=rc, constraints=“admin_SaveProject”);
transaction
{
if(!prc.results.hasErrors()) {
var project = ProjectService.get(“Project”, rc.projectId);
var projectType = ProjectService.get(“ProjectType”, rc.ProjectType);
var internalCo = ProjectService.get(“InternalCompany”, rc.InternalCompany);
project.setIsPrivate(rc.isPrivate);
project.setProjectType(projectType);
project.setInternalCompany(internalCo);
project.setProjectName(event.getTrimValue(“ProjectName”));
project.setProjectNumber(event.getTrimValue(“projectNumber”));
project.setOpportunityNumber(event.getTrimValue(“OpportunityNumber”));
project.setIsRecoveryFunded(rc.IsRecoveryFunded);
project.setProjectDescription(event.getTrimValue(“ProjectDescription”));
project.setSubmittalRequirements(event.getTrimValue(“SubmittalRequirements”));
project.setAdditionalInformation(event.getTrimValue(“AdditionalInformation”));
project.setBidInviteIntro(event.getTrimValue(“BidInviteIntro”));
transaction action=“commit”;
event.renderData(type=“JSON”, data={success=1});
} else {
event.renderData(type=“JSON”, data=prc.results.getAllErrors());
}
}
}