function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

how do I get default field values to show up in an inputfield for custom vf page

I am trying to get the inputfields on a custom new page I've created to show the default field values.  Right now I'm manually assigning the default values to the appropriate fields in my constructor, but it seems like there should be a better way to do this. Anyone have any ideas?


I also have a pageblocktable of child objects on that page (for mass creation.) Is there a way to have the code field (a formula field based on the product field) show up when someone fills in the product field?


child object pageblocktable:


<apex:pageBlockTable border="0" cellpadding="6" value="{!NewItems}" var="item" id="rows">
<apex:column headervalue="Product">
<apex:inputField id="prod" value="{!item.Product__c}" required="false" /> </apex:column>
<apex:column headervalue="Code">

  The following outputfield remains blank no matter what I do. I want it to show the results of the code__c formula

<apex:OutputField value="{!item.Code__c}" />





Message Edited by grigri9 on 02-15-2009 08:45 PM
Message Edited by grigri9 on 02-15-2009 08:45 PM

It looks like the only way I can get the formula fields to show up is to get the product field values into my controller and then have SOQL queries that recreate the formula's. This seems to do something similiar:


controller communicaton with javascript


But I'm not really clear, how would I get the value of the inputfield into the controller without submitting the form?





     Try this following sample code.. Here I am getting  first text box value (Onchange of first textbox) in controller and assign this value into second text box..

I hope it will help u..

Page: <apex:page controller="inputfield" > <apex:form> <apex:outputlabel value="First Textbox"/> <apex:inputfield value="{!inse.Name}"> <apex:actionsupport action="{!getName}" event="onchange" rerender="Name"/> <apex:outputlabel value="Second Textbox"/> </apex:inputfield> <apex:inputtext value="{!NameAcc}" id="Name"/> </apex:form> </apex:page> Controller: public class inputfield { Account inse=new Account(); String Name; String Parent; public Account getinse() { return inse; } public void getName() { Name=inse.Name; } public String getNameAcc() { return Name; } public void setNameAcc(String a) { Name=a; } }