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
sdbsdb 

Referencing a field inside a fieldset?

I have a fieldset that encapsulates fields from Contact: salutation, firstName, middleName and lastName. The fieldset looks like this within my Visualforce page:

 

<apex:repeat value="{!$ObjectType.Contact.FieldSets.Personal_Information}" var="pi" >             

      <apex:inputField id="personalInfoContact" value="{!contact[pi]}" />         

</apex:repeat>

 

I'd like to be able to reference the lastName field within the fieldset from JavaScript. Is there any way to get the id of a field within a fieldset?

hemantgarghemantgarg

Yes, it is possible. You can use it according to your requirement.

 

<apex:repeat value="{!$ObjectType.Contact.FieldSets.Personal_Information}" var="pi" >   

        <script>alert('{!pi}');</script>

      <apex:inputField id="personalInfoContact" value="{!contact[pi]}" />         

</apex:repeat>



sdbsdb

Hi, thanks for your response. I tested with your approach, but it still appears that there is no way to determine the javascript id of a field inside a fieldset.  I think that this is a limitation of field sets.

hemantgarghemantgarg

FieldSet works as a set of data instead of any visualforce tag, so can you please clear out your need .