You need to sign in to do that
Don't have an account?
Cindy Norman
Total newbie question - value from inputField not reflected in my custom object
Hi-I'm sure this is a no-brainer for all of you guys but i'm having trouble with this. I'll be general because i'm not sure what part of my code is messed up.
************
I have some apex:inputFields that display data from a custom object- this works fine
<apex:outputLabel value="Number of Dependents on Application" styleClass="inputFieldLabelStyle"/>
<apex:inputfield value="{!application.numberOfDependents__c }" styleClass="inputFieldStyle"/>
</apex:pageBlockSectionItem>
*************
AND a button that fires correctly when the user clicks it:
<apex:commandButton value="Save and Continue" style="width:180px;" action="{!SaveApp}" immediate="true" rerender="ApplicationSubTabPanel,showmsgs"/>
**************
And the method defined in the controller:
public PageReference SaveApp()
{
try {
upsert(application);
} catch(System.DMLException e) { .... }
return null; //tells VF to refresh page.
}//end PageReference SaveApp()
**********
Pretty easy stuff. But the values never get saved in the DB. Any silliness that i have overlooked? an "onchange" or ?
Thank you!!
************
I have some apex:inputFields that display data from a custom object- this works fine
<apex:outputLabel value="Number of Dependents on Application" styleClass="inputFieldLabelStyle"/>
<apex:inputfield value="{!application.numberOfDependents__c }" styleClass="inputFieldStyle"/>
</apex:pageBlockSectionItem>
*************
AND a button that fires correctly when the user clicks it:
<apex:commandButton value="Save and Continue" style="width:180px;" action="{!SaveApp}" immediate="true" rerender="ApplicationSubTabPanel,showmsgs"/>
**************
And the method defined in the controller:
public PageReference SaveApp()
{
try {
upsert(application);
} catch(System.DMLException e) { .... }
return null; //tells VF to refresh page.
}//end PageReference SaveApp()
**********
Pretty easy stuff. But the values never get saved in the DB. Any silliness that i have overlooked? an "onchange" or ?
Thank you!!
Thanks,
Kaustav
<apex:commandButton value="Save and Continue" style="width:180px;" action="{!SaveApp}" immediate="false" rerender="ApplicationSubTabPanel,showmsgs"/>
I put immediate=true in there because it kept some validations from firing (upon upsert) on a related object (which seemed stupid to me but i couldn't get around that any other way.)
Hmmm...In your highly valued opinions, what would you suggest?
Keeping validation from firing some other way OR
Convincing VF to get my values some other way?
I surely wish SF would document this super valuable info you guys are giving me!
Thank you!
I have a custom object "application__c" and a related list of applicants__c linked by a master-detail relationship.
On the first tab, i have the application__c fields. In another tab, i have the input fields for the applicant.
Trouble is, the user has only input the application__c values and hasn't gotten to the tab to input the applicants yet.
But i want to save the application data before proceeding to the applicant input.
And doing a "Save"/upsert of the application object/record fails because there are no values in the applicant fields yet.
It is kicking off the validation rules for the related list: applicants__c!
Seems superbly stupid to me to require this...so i must be messing something up there.
So, by putting "immediate" in there, it didn't give me errors on the applicant input (i'm guessing you saying
it isn't checking the application input either? not good.)
I'm in a catch-22...trying to get around this firing of validation rules on my related object and also trying to
have my values saved in the database.
Seems that something is wrong...SF can't possibly be working this way on purpose....
You can try this out.
What we are trying to do hre in this code is still keep the immediate attribute but pass the user entered value as a parameter to the controller.
Thanks,
Kaustav
<apex:inputfield value="{!applicant.application__c }" styleClass="inputFieldStyle" required="false"/>
You guys have convinced me to leave the immediate="true" in there on my "SaveApp" button
and, it seems, cleanest to use the required="false" on my applicant input on the other tab.
But i hate to do this (because it makes the UI less informative) and am surprised i have to.
It comes down to this question: ?????
When i do my upsert of my application__c object/record, **why** is it doing validation checks on my applicant__c information???
yes, they are related thru a master-detail relationship but...that can't be the reason, is it?
Thanks,
Kaustav