• Div403
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 14
    Replies
Hi All,

I am unable to pass the values from input hidden values to javascript function.

In javascript i am not able to get the URL from controller. When i click button, alert box is not displaying.

Please find the below code
VisualForce Page Code
<apex:page controller="ExampleController" action="{!ExampleMethod}">
<script>

function URL()
{
    var URL = document.getElementById('{!$Component.theHiddenInput}').value;

    alert('URL'+URL);
}
</script>
<apex:form >
  <apex:pageMessages />
  <apex:inputHidden value="{!values}" id="theHiddenInput"/>
<apex:commandButton onclick="URL()" value="OK" rerender="e"/>
 </apex:form>
</apex:page>

Apex Code

public with sharing class ExampleController{
Public string values{get; set;}
public ExampleController(){
values = System.currentPageReference().getParameters().get('URL');
System.debug('URL'+values);
}

public pagereference ExampleMethod(){
Public String URL='https://google.co.in';
PageReference Page=new PageReference(URL);
         Page.Redirect(true);
         return Page;
}
}
 
Hi All,

I am trying to open google chrome window while clicking on salesforce custom button in Internet Explorer.

I am trying the below javascript code to open chrome browser in internet explorer by clicking on custom button

function openChrome{
var url = 'http://google.co.in';
var chromeCommand = "Chrome --app="+URL+" --allow-outdated-plugins";
var shell = new ActiveXObject("WScript.Shell");
shell.run(chromeCommand);
}

Any help is appreciated!!
Hi All,

I am unable to pass the custom field values to the below alert box. My scenario is like when i click on the custom button, i need to pass item_id__c via url to open the visual page. 

var Account = "{!Account.Id}";
var AccountName = "{!Account.Name}";
var ItemName= "{!Account.Item_ID__c}";
if(Account!=null)
{
alert('Account'+ItemName);
window.open('https://www.google.com?item='+ItemName);
}
Hi All,

When i click on any row using onrowclick function in apex:pageBlockTable. I am able to select the row using javascript functionality but i am not able to get the selected row data to from vf page to controller/avascript to populate selected row data in alert box.

Can any one help me How to get selected row data in controller? 

Please find the vfpage and controller

Visualforce Page
 
<apex:includeScript value="{!URLFOR($Resource.jquery,'/js/jquery-1.4.2.min.js')}" /> 
<script> $j = jQuery.noConflict(); 
var lastRow; 
var sample = document.getElementById('Name').value; 
var firstname1 = document .getElementById('{!$Component.form.pageBlockContact.Name}').value; 
function highlight(elem)
{ if(lastRow != undefined)
lastRow.style.backgroundColor = 'white';
elem.style.backgroundColor = 'yellow'; lastRow = elem;
alert('DDDD'+firstname1 );
alert('DDDDDDD'+sample); 
} 
</script>
<apex:form id="form"> 
<apex:pageBlock id="pageBlockContact"> 
<apex:pageBlockSection columns="1"> 
<apex:pageBlockTable value="{!list1}" var="item" rules="rows" id="example" onRowClick="clickElem(this);"> 
<apex:column value="{!item.Name}" id="Name" styleclass="name" /> 
</apex:pageBlockTable> 
</apex:pageBlockSection>
<apex:commandButton action="{!ok}" value="ok" /> 
</apex:pageBlock>
</apex:form>
</apex:page>

Controller
 
public class SampleController {

    public PageReference ok() {
        return null;
    
    }
    
    public List<Claims__c> list1 { get; set; }

   
    public SampleController ()
{
   list1 = [select id,name from claims__c];
}

}

Output: Based on above vf page and controller
User-added image
Hi All,

I have tried so many functioanlities but am unable to insert the checkbox value in custom object 

Kindly help me out of this

VF Page
<apex:page standardcontroller="TestExample__c" extensions="TestExample">
<apex:form>
<apex:selectCheckboxes title="Reinsurance Verification" value="{!test.TestPage__c}">
             <apex:selectOption value="{!test3}"> </apex:selectOption>
         </apex:selectCheckboxes>
<apex:outputPanel layout="block">
    <apex:commandButton value="Save and Close"   action="{!Save}"/>                           
        </apex:outputPanel>                              
</apex:form>
</apex:page>

controller

public class TestExample{
public TestExample Test{get; set;}
public SelectOption test3 {get;set;}
public TestExample{
test3 = new SelectOption('Apex', 'Apex');
test=new TestExample__c();    
}
public PageReference Save() {
TestExample__c t = new TestExample__c();
t.TestPage__c = Test.TestPage__c;
insert t;
}
}
Hi All,

I have created a new apex class and vf page to insert data into a custom object. I am able to insert record in custom object but values are not displaying in record which i have given in vf page.

Kindly help me to solve this

VF Page
<apex:page standardcontroller="Claims__c" extensions="NotesController11">
<apex:form>
<h1 style="font-size:30px"><Center> Reinsurance Verification</center> </h1>
<apex:pageBlock id="Details">
<apex:pageBlockSection columns="2" title="Company Information">
<apex:inputfield value="{!Test.Claim_Numbers__c}"/> 
</apex:pageBlockSection>            
</apex:pageBlock>
<apex:outputPanel layout="block">
<apex:commandButton value="Save and Close" action="{!Save}" immediate="true" /> 
</apex:outputPanel>                          
</apex:form>                               
</apex:page>

Apex Controller

public class NotesController11 {

    public Claims__c Test{get; set;}
    public NotesController11(ApexPages.StandardController controller) {
        test= new Claims__c();
        }

    public PageReference Save() {
 
        Claims__c rv = new Claims__c();
        rv.Claim_Numbers__c= Test.Claim_Numbers__c;
        insert rv;
        PageReference Page = new PageReference('/'+rv.id);
        Page.setRedirect(true);
        return Page;

    }

}

Output:

User-added image
trigger DuplicateAccountNameCountryCheck1 on Account (before insert, before update)
{
    For(Account a:Trigger.New)
    {
        List<Account> acc=[SELECT Id, Name FROM Account WHERE Name=:a.Name AND BillingCountry=:a.BillingCountry];
        if(acc.size()>0)
        {
            a.addError('You are not allow to create duplicate Account Name with the same Country');
        } 
    }
}
I am recieving the following error message when trying to load records in vf page

"List controllers are not supported in Campaign Members"

Can anyone knows the solution for the above error? Please help us.

Thanks in advance

Hi, 

 

  I am new to SalesForce and Am newbie learning Visual Force and Apex Codding. I created a new custom object with name customer_details_c and desinged a page using visual force. 

 

 In customer_details_c object it has First_Name_c and Last_Name_c as two custom fields. 

 

 Now My requirement is to create a class or controller to insert the data into customer_details_c object. Please suggest me know. How to write the class or controler with an example. 

 

Thanks

Sudhir