You need to sign in to do that
Don't have an account?
Jyothsna Reddy
DynamicForm Building
Hi all,
I have MappingObject -----> Fields are::::::::::::::FieldName__c,FieldCaption__c && FieldType__c
Here I am trying to get the records based on FieldType__c(like ::::text,textarea). If FieldType is text it will show textbox.I did this finally using rendered.But my problem is after submitting I am not getting the entered value.How can I solve this.
I am not even getting any error.
Please find the below code.I thought problem is storing the values.
Controller Code:
I have MappingObject -----> Fields are::::::::::::::FieldName__c,FieldCaption__c && FieldType__c
Here I am trying to get the records based on FieldType__c(like ::::text,textarea). If FieldType is text it will show textbox.I did this finally using rendered.But my problem is after submitting I am not getting the entered value.How can I solve this.
I am not even getting any error.
Please find the below code.I thought problem is storing the values.
<apex:pageBlock id="box"> <apex:repeat value="{!inputFields}" var="m"> <apex:outPutLabel value="{!if(m.FieldType__c == 'Text',m.FieldCaption__c,'')}"/> <apex:inputText value="{!inputFields[m]}" rendered="{!if(m.FieldType__c == 'Text' ,true,false)}" /> <!--<apex:outPutLabel value="{!if(m.FieldType__c == 'Textarea',m.FieldCaption__c,'')}"/> <apex:inputtextarea value="{!inputFields[m]}" rendered="{!if(m.FieldType__c == 'Textarea',true,false)}" /> --> </apex:repeat> <apex:commandButton action="{!submitFieldData}" value="Submit" id="button" rerender="box"/> {!strList}
Controller Code:
public class repeatandsave { public List<String> strList { get; set; } public Map<String,List<String>> outputFields { get; set; } public Map<Mapping__c,String> inputFields { get; set; } public List<Mapping__c> mapList{get;set;} public String str{get;set;} public repeatandsave(){ strList=new List<String>(); inputFields=new Map<Mapping__c,String>(); mapList=new List<Mapping__c>(); mapList=[SELECT FieldCaption__c,FieldName__c,FieldType__c,Name from Mapping__c where formname__c ='empform1']; for(Mapping__c map1:mapList){ System.debug(':::::::::::+before ++'+map1); inputFields.put(map1,''); System.debug(':::::::::::+after++'+map1); } System.debug('::::::::::::'+ inputFields.keyset()); System.debug('::::::::::::::::values::::::::'+inputFields.values()); } public PageReference submitFieldData() { System.debug('Inside submit:::::::::::'+maplist); for(Mapping__c map1 : mapList){ System.debug('::::::::::::map1 values are::::::::::'+map1); inputFields.get(map1); System.debug('Map values are:'+inputFields.get(map1)); //System.debug('::::::::::::::map1values are :::::::::::::::'+outputFields.get(map1.FieldName__c)); //strList.add(outputFields.get(map1.FieldName__c)); }/* for(String str:strList){ System.debug('Added Elements are ::::::'+str); } System.debug('In submitt::::::::::::'); */ return null; } }
Screen Shot::::::::::::
Controller - Change the Map to use Id as the Key instead of SObject
Page -
Let me know if this works. Thank you
All Answers
Controller - Change the Map to use Id as the Key instead of SObject
Page -
Let me know if this works. Thank you
I did some more modifications here.
Anyways It helped me...