2

I'm pretty new to salesforce and visualforce, so this question may sound trivial.

Here is my visualforce code

<div class="current-country-wrapper group">
   <div class="current-country country-fr f-left">France</div>
   <a href="#" class="country-list-trigger f-right">Not in <span>France</span>?</a>
   <a href="#" class="country-list-select hide f-right">Select your country</a>
</div>    



<div class="iscroller-wrapper">
    <ul class="country-list">
        <apex:form>
            <apex:repeat value="{!countryOptionList}" var="rec">
                <li><a href="#" class="country-list-item"> {!rec.label} </a>
                </li>
            </apex:repeat>
        </apex:form>
    </ul>
</div>

In the second div portion i'm binding the country list from salesforce.Using jQuery i'm setting the value of the selected country from the list to the div

<div class="current-country country-fr f-left">France</div>

in first portion of visualforce code. The issue is when i try to save the country data i need to value of the selected country. Normally when a apex element is used we can get the value from visualforce to controller using the value attribute as follows

<apex:inputField styleClass="text" id="policyArea" value="{!regulationDataCat.Area__c}"/>

But in my case i'm wondering how to get this working to get the value of selected country into the controller since i don't use a apex element.

2

Ideally when you declare your variable as getter and setter property on selection you just need to make sure you use the merge field of the field and it should reflect back in controller

public class selectedflag{
   public string selectedvalue {get;set;}
}

For your code we can use apex:param tag and that has more flexibility to pass the parameter back to controller using assign to attribute

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_param.htm

//vf code 


  <div class="current-country-wrapper group">
 <div class="current-country country-fr f-left">France</div>
 <a href="#" class="country-list-trigger f-right">Not in <span>France</span>?</a>
 <a href="#" class="country-list-select hide f-right">Select your country</a>
</div>    



<div class="iscroller-wrapper">
<ul class="country-list">
    <apex:form>
        <apex:repeat value="{!countryOptionList}" var="rec">
            <li><a href="#" class="country-list-item"> {!rec.label} 
             <apex:param name="q" value="{!rec.label}" assingTo={!selectedvalue}/></a>
            </li>
        </apex:repeat>
    </apex:form>
</ul>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.