I have the following drop down, and I want to send the value of the selected file to my controller .. so if the user selects parent account1 my controller should get that value or if they select parent account2 same thing
VF
<label>Select the Region</label>
</td>
<td class="data2Col" style="border-bottom:0px;">
<select id="sandler" class="sandler" value="{!regionAccount}">
<option value=""></option>
<option value='ParentAccount1'>asdf--zz</option>
<option value='ParentAccount2'>ggggg</option>
</select>
</td>
controller
// Recieve the Region Value from Visual Force Page..
public String regionAccount{get;set;}
public Account regionAccountId{get;set;}
// if regional is not empty
if (regionAccount != Null ){
// get the value of region and find the accountId
regionAccountId = [select Id from Account where Name = : regionAccount];
account.ParentId =regionAccountId.Id;
}
else{
for (Contact parents : parentAccount)
{
System.debug('Now I get to here part 2');
account.ParentId = parents.AccountId;
}
}
Best Answer
As these are html tags so you can't directly pass the value in controller so I suggest you to first get this in javascript
then using actionfunction pass this in controller.