You need to sign in to do that
Don't have an account?
prasanth kumar
pageblock hide and show partially not working please help
i have two apex:pageblock in visualforce page. 1st pageblock will displays always. 2nd pageblock should be display with if condition, but it is not working ... please help. I checked this - data coming to javascript and alert boxes are working.
<apex:page controller="myleaddata" id="p1"> <apex:form id="f1"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> $j = jQuery.noConflict(); var a; function mydata() { a=document.getElementById('p1:f1:pb:my1').value; document.getElementById('p1:f1:pb:my2').value=a; if(a=='New Employee') { alert('this is 1st alert'); j$(document).ready(function() { j$('div#hidden').show(); }); } else { alert('this is 2nd alert'); j$(document).ready(function() { j$('div#hidden').hide(); }); } } </script> <apex:pageblock title="Basic lead info" id="pb"> <apex:outputlabel value="company name" /> <apex:inputtext value="{!companyname}" /><br/> <apex:outputlabel value="lead last name" /> <apex:inputtext value="{!lastname}" /><br/> <apex:outputlabel value="phone number" /> <apex:inputtext value="{!phone}" /><br/> <apex:outputlabel value="Email" /> <apex:inputtext value="{!email}" /><br/> <apex:outputlabel value="Source" /> <apex:inputtext value="{!source}" /><br/> <apex:outputlabel value="Referer" /> <apex:inputfield value="{!le.Reffered__c}" id="my1" onchange="mydata()" /><br/> <apex:inputhidden id="my2" value="{!referer}" /> </apex:pageblock> <div id="hidden" > <apex:pageblock title="address info" > <apex:outputlabel value="street" /> <apex:inputtext value="{!street1}" /><br/> <apex:outputlabel value="city" /> <apex:inputtext value="{!city1}" /><br/> <apex:outputlabel value="state" /> <apex:inputtext value="{!state1}" /><br/> <apex:outputlabel value="zip" /> <apex:inputtext value="{!zip1}" /><br/> <apex:outputlabel value="country" /> <apex:inputtext value="{!country1}" /><br/> </apex:pageblock></div> <apex:commandButton value="submit" action="{!myleaddata1}" /> </apex:form> </apex:page>
Apex:code public class myleaddata { public string lastname{set;get;} public string companyname{set;get;} public string leadname{set;get;} public string phone{set;get;} public string email{set;get;} public string source {set;get;} public string referer{set;get;} public string street1{set;get;} public string city1{set;get;} public string state1{set;get;} public string zip1{set;get;} public string country1{set;get;} public lead le{set;get;} public void myleaddata1() { if(referer == 'existing employee') { Opportunity opp=new Opportunity(); opp.Name=lastname; opp.StageName='qualification'; opp.LeadSource=source; opp.CloseDate=date.parse('8/10/2015'); insert opp; } else { lead l1=new lead(); l1.lastname=lastname; l1.Company=companyname; l1.Phone=phone; l1.email=Email; l1.LeadSource=source; l1.Reffered__c=referer; // address info part l1.PostalCode=zip1; l1.Street =street1; l1.City=city1; l1.state=state1; l1.PostalCode=zip1; l1.Country=country1; insert l1; } } }
Try this for your apex page.
Thx
All Answers
Try this for your apex page.
Thx
Try this and check one may be it will solve your issue.
Thanks
Sunil
Thx