+ Start a Discussion
Niraj Kumar 9Niraj Kumar 9 

Hi, Lookup is not working in salesforce1

Hi Guys,
Lookup is not working fine in salesfeorce1 but working fine in Salesforce.
Here is the code::

<apex:selectList value="{!selectedUser}" size="1" id="UsrSelLst">
                   <apex:selectOptions value="{!SelectedUserList}"  id="UsrSelOpt" />
                   </apex:selectList>

Lookup is open in new windows but after selection of user nothing happen.
 
Rajiv Penagonda 12Rajiv Penagonda 12
The code sample you have attached is too little to get the idea of the issue you are facing. I do not see any "onchange" event defined on the selectList, technically "after selection of user" nothing will happen. Unless, the onchange event is added through jQuery or someother JavaScript framework.
Niraj Kumar 9Niraj Kumar 9
Hi Rajiv,
Its perfectly working in Salesforce , my doubt on using of <apex:selectlist> I think its not supported by salesforce 1.

How can I handle this.Please dont bother about the controller.
If u have any Idea please help me.

Here is the full Code:::::
<apex:page id="pg" standardController="Siebel_Quote__c" extensions="RequestSiebelQuote" tabStyle="Siebel_Quote__c" action="{!CheckForSOS}" standardStylesheets="false" sidebar="false" >

<script>
    function test(){
    
     // alert('You are here');
        UsQe = document.getElementById('pg:frm:Pb:pbs:UsrSelLst').value;
        UsQeId = document.getElementById('pg:frm:Pb:pbs:UsrSelLst').value;
        UsQeId = document.getElementById('pg:frm:Pb:pbs:HdUsrSelId').value;
        var retvalId = UsQeId;
       // alert('test+'+retvalId);
         ReturnValueUpdateAction(retvalId);
    
    }
   
    
    
    function getCheckedValue() { 
    //alert('Inside JS');
     var rt = document.getElementById('pg:frm:Pblk:SelLstRT').value;
      var UsQe= '' ;
        if(document.getElementById('pg:frm:Pb:pbs:UsrSelLst') != null) 
      { 
    //   alert('text'+ document.getElementById('pg:frm:Pb:pbs:UsrSelLst').text);
    //   alert('value'+ document.getElementById('pg:frm:Pb:pbs:UsrSelLst').value);     

        UsQe = document.getElementById('pg:frm:Pb:pbs:UsrSelLst').value;
        UsQeId = document.getElementById('pg:frm:Pb:pbs:UsrSelLst').value;
      
       
        
        ownerUpdateAction(own,UsQeId,rt,main,contId);
      }

       var statustxt = document.getElementById('pg:frm:Pb:pbs:txtHd2').value;
      if(statustxt != '')
      { 
         UsQe=document.getElementById('pg:frm:Pb:pbs:txtHd2').value;
      }
       var UsQeId;
       var ch = false;
       var LUch = false;
      // var rt = document.getElementById('pg:frm:Pblk:SelLstRT').value;
       var radio = document.getElementsByName('sos');
       var LUradio = document.getElementsByName('LUsos');
       for(var j=0; j < radio.length; j++)
       {
       if(radio[j].checked)
       ch = true;
       }  
       
       for(var s=0; s < LUradio.length; s++)
       {
       if(LUradio[s].checked)
       LUch = true;
       }
        
        var own;
        var main;
        var contId;
        if(rt == '')
       {
       alert("Please select a Customer Admin Activity type and then proceed.");
        return false;
       }
       if(UsQe == '' && ch == false && LUch == false)
       {
       alert("Please select either User/Queue or select a member from Account Owner's Default Sales team as Owner or select a member from running user's Default Sales team as Owner");
       }
       else if(UsQe != '' && ch == true && LUch == true)
       {
       alert("Please select only a User/Queue or a member from the Account Owner's Default Sales Team or a member from the running user's Default Sales Team - Delete the User/Queue value if you want to select a Default Sales Team member"); 
       
       var radList = document.getElementsByName('sos');
        for (var r = 0; r < radList.length; r++) 
        {
        if(radList[r].checked) 
        radList[r].checked = false;
        }
        var LUradList = document.getElementsByName('LUsos');
        for (var m = 0; m < LUradList.length; m++) 
        {
        if(LUradList[m].checked) 
        LUradList[m].checked = false;
        }
        
       }
       
       else if(UsQe != '' && ch == true)
       {
       alert("Please select only a User/Queue or a member from the Account Owner's Default Sales Team - Delete the User/Queue value if you want to select a Default Sales Team member"); 
       
       var radList = document.getElementsByName('sos');
        for (var r = 0; r < radList.length; r++) 
        {
        if(radList[r].checked) 
        radList[r].checked = false;
        }
       }
        
       else if(UsQe != '' && LUch == true)
       {
       alert("Please select only a User/Queue or a member from the Running User's Default Sales Team - Delete the User/Queue value if you want to select a Default Sales Team member"); 
       
       var LUradList = document.getElementsByName('LUsos');
        for (var m = 0; m < LUradList.length; m++) 
        {
        if(LUradList[m].checked) 
        LUradList[m].checked = false;
        }
       }
       
       else if(ch == true && LUch == true)
       {
       alert("Please select either a member from the Account Owner's Default Sales Team or a member from the running user's Default Sales Team"); 
       
       var radList = document.getElementsByName('sos');
        for (var r = 0; r < radList.length; r++) 
        {
        if(radList[r].checked) 
        radList[r].checked = false;
        }
        var LUradList = document.getElementsByName('LUsos');
        for (var m = 0; m < LUradList.length; m++) 
        {
        if(LUradList[m].checked) 
        LUradList[m].checked = false;
        }
       }
        
       else if(UsQe != '' && ch == false && LUch == false)
        {
         if({!msc})
         {
            main=document.getElementById('txtUsrFrm').value;
            contId =document.getElementById('contId').value;
         }
          own=document.getElementById('pg:frm:Pb:pbs:txtHd2').value;
          UsQeId=document.getElementById('pg:frm:Pb:pbs:txtHdId').value;
          ownerUpdateAction(own,UsQeId,rt,main,contId);
        }
       
       else  if({!show} && ch == true){
        var arr = new Array();
        arr = document.getElementsByName('sos');
        if({!msc}){
         main=document.getElementById('txtUsrFrm').value;
         contId =document.getElementById('contId').value;
       }
       if(ch == true)
       {
        for(var i = 0; i < arr.length;i++)
           {
            var obj = document.getElementsByName('sos').item(i);
            if(obj.checked){
                 UsQeId=obj.value;
                 ch=true;
             }
           }
       }
           ownerUpdateAction(own,UsQeId,rt,main,contId);
       } 
       
       else  if({!showLU} && LUch == true){ 
        var arr1 = new Array();
        arr1 = document.getElementsByName('LUsos');
        
        if({!msc}){
         main=document.getElementById('txtUsrFrm').value;
         contId =document.getElementById('contId').value;
       }
       if(LUch == true)
       {    
           for(var a = 0; a < arr1.length;a++)
              {
            var obj1 = document.getElementsByName('LUsos').item(a);
            if(obj1.checked){
                 UsQeId=obj1.value;
                 ch1=true;
             }
           }
       }
           
           ownerUpdateAction(own,UsQeId,rt,main,contId);
       }
       
     }
     function openLookUp(id)
        {
             var newWindow = window.open( '/apex/Lookup_RQ?accId='+id , '_new', 'resizable=yes,scrollbars=yes,status=yes,toolbar=false,height=600,width=800,top=100,left=100');
             newWindow.creator=self;
        }
        
        function openQULookUp(id)
        {
            var txtval;
            var txtval1;
            txtval=document.getElementById('pg:frm:Pb:pbs:SelLst').value
            txtval1= '';
            if(document.getElementById('pg:frm:Pb:pbs:txtHd2') != null) 
               txtval1=document.getElementById('pg:frm:Pb:pbs:txtHd2').value;
            else {
               var p = document.getElementById('pg:frm:Pb:pbs:UsrSelLst').selectedIndex ;
               txtval1 = document.getElementById('pg:frm:Pb:pbs:UsrSelLst').options[p].text
             }
             
             if(txtval == 'User')
             { 
             var newWindow = window.open( '/apex/UsrLookup?UsrId='+txtval1+'&selected=user&accId='+id, '_new', 'resizable=yes,scrollbars=yes,status=yes,toolbar=false,height=600,width=800,top=100,left=100');
             newWindow.creator=self;
             }
             else if (txtval == 'Queue')
             {
             var newWindow = window.open( '/apex/QueLookup?QueId='+txtval1+'&selected=Queue&accId='+id, '_new', 'resizable=yes,scrollbars=yes,status=yes,toolbar=false,height=600,width=800,top=100,left=100');
             newWindow.creator=self;
             }
             
        }
  </script>
<apex:form id="frm">
 <apex:pagemessages />
  
  
  
   <apex:actionFunction name="ReturnValueUpdateAction" action="{!ReturnValueUpdate}"   rerender="pg:frm:Pb:pbs:OutList">
         <apex:param name="ReturnValId" assignTo="{!ReturnValId}" value="" id="RvId"/>
        
    </apex:actionFunction>     
  
  <apex:actionFunction name="ownerUpdateAction" action="{!OwnerUpdate}" rerender="frm">
         <apex:param name="UID" assignTo="{!UID}" value="" id="t"/>
         <apex:param name="UsQeId" assignTo="{!UsQeId}" value="" id="UQ"/>
         <apex:param name="rt" assignTo="{!rt}" value="" id="RT"/>
         <apex:param name="Con" assignTo="{!Con}" value="" id="l"/>
         <apex:param name="ContId" assignTo="{!ContId}" value="" id="s"/>
  </apex:actionFunction>
  
    
      
    <apex:pageBlock id="Pblk" title="Select 'Customer Admin Activity' type">  
     <apex:outputLabel id="OLb" style="vertical-align:text-top;font-weight : bold" value="Customer Admin Activity Type">
     <img src="/s.gif" alt="Help" class="helpOrb" title="{!helptext}"/></apex:outputLabel> 
       
         <apex:selectList value="{!RecordType}" size="1" id="SelLstRT">
          
         <apex:selectOptions value="{!RTValues}" id="SelOptIdRT"/>
         </apex:selectList>
     
    </apex:pageBlock> 
        
    <apex:pageBlock id="Pb" title="Select 'Customer Admin Activity Record' Owner">
        <apex:pageBlockSection id="pbs" title="Please assign this to a Sales Order Specialist from yours or the Account Owner Sales Team or Queue" >  
           
        
         

<!-- Your SOS-->
<apex:outputlabel style="font-weight:bold;margin-top:10px">Select from your Sales Order Specialist Team Members</apex:outputlabel><br/>
      <apex:pageBlockTable style="margin-bottom:20px" value="{!LoggedUTM}" var="o" >
              <apex:column headerValue="Name">
                  <apex:OutputText value="{!o.User.Name}"/>
              </apex:column>  
             <apex:column headerValue="Role">
                   <apex:OutputText value="{!o.User.tfcrmTeamRole__c}"/>
             </apex:column> 
             <apex:column headerValue="Select a Member">
                  <input type="radio" name='LUsos' value="{!o.User.Id}"/>               
             </apex:column>             
       </apex:pageBlockTable>
<br/>

<!-- AM SOS-->

          <apex:outputlabel style="font-weight:bold;margin-top:10px">OR Select from the Account Owner Sales Order Specialist Team Members</apex:outputlabel><br/>
       <apex:pageBlockTable style="margin-bottom:20px" value="{!utm}" var="o" >
              <apex:column headerValue="Name">
                  <apex:OutputText value="{!o.User.Name}"/>
              </apex:column>  
             <apex:column headerValue="Role">
                   <apex:OutputText value="{!o.User.tfcrmTeamRole__c}"/>
             </apex:column> 
             <apex:column headerValue="Select a Member">
                  <input type="radio" name='sos' value="{!o.User.Id}"/>               
             </apex:column>             
       </apex:pageBlockTable>  

<br/>
<!--U/Q lookup-->

<apex:outputlabel style="font-weight:bold;margin-top:10px">OR Search and select for a Sales Order Specialist or Queue</apex:outputlabel><br/>
<apex:outputPanel id="lookupQU"> 
            <apex:outputLabel id="Ol" style="text-align:left;font-weight : bold" value="Owner ">&nbsp;</apex:outputLabel>     

         
                <apex:selectList value="{!QueueUser}" size="1" id="SelLst"> 
                <apex:selectOptions value="{!Items}" id="SelOptId"/>   
                </apex:selectList>
                               &nbsp;
                <apex:outputpanel rendered="{!showLookup}">
                  <apex:inputText id="txtHd2" value="{!custAA.Owner.Name}"/> 
                 
                 <a href="#"  id="lookupPickTechMask1"  title="User or Queue LookUp (New Window)" onclick="openQULookUp('{!accountId}');">
                            <img src="/s.gif" alt="TechMask Lookup (New Window)"  class="lookupIcon" onblur="this.className = 

'lookupIcon';"    onfocus="this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 

'lookupIcon';"    onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" title="User or Queue LookUp 

(New  Window)"/>
                  </a>             
                </apex:outputpanel>
                <apex:outputpanel rendered="{!NOT(showLookup)}" id="OutList">
                <apex:inputHidden id="HdUsrSelId" value="{!ReturnValId}"/>
                
               
      <apex:selectList value="{!selectedUser}" size="1" id="UsrSelLst">
                   <apex:selectOptions value="{!SelectedUserList}"  id="UsrSelOpt" />
                   </apex:selectList>


                   <a href="#"  id="lookupPickTechMask1"  title="User or Queue LookUp (New Window)" onclick="openQULookUp

('{!accountId}');">
                            <img src="/" alt="TechMask Lookup (New Window)"  class="lookupIcon" onblur="this.className = 

'lookupIcon';"    onfocus="this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 

'lookupIcon';"    onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" title="User or Queue LookUp 

(New  Window)"/>
                  </a>
                  <apex:pagemessages />
                </apex:outputpanel>
                <apex:inputHidden id="txtHdId" value="{!usqe}"/>
            </apex:outputPanel>
       
       
      
     </apex:pageBlockSection> 
      </apex:pageBlock>      <br />  
    

        
     <apex:pageBlock title="Select a Main Sales Contact from the Account Hierarchy" rendered="{!(msc)}" helpTitle="Help for this Page" helpUrl="help">
         <apex:pageBlockSection columns="2">
            <apex:outputField value="{!conFunAcc.Account_Id__c}"/> 
             
             <apex:pageblockSectionItem >
                 <apex:outputlabel style="vertical-align:text-top;font-weight : bold">Main Sales Contact</apex:outputlabel>
                 <apex:outputPanel id="lookup">
                 <input type="text" id="txtUsrFrm"/>
                 <input type="hidden" id="contId"/>                
                     <apex:inputHidden id="txtHd" value="{!val}"/>
                     <a href="#"  id="lookupPickTechMask"  title="Main Sales Contact Lookup (New Window)" onclick="openLookUp('{!conFunAcc.Account_Id__c}');">
                            <img src="/s.gif" alt="TechMask Lookup (New Window)"  class="lookupIcon" onblur="this.className = 'lookupIcon';"    onfocus="this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';"    onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" title="Main Sales Contact Lookup (New  Window)"/>
                         </a>
                 </apex:outputPanel> 
             </apex:pageblockSectionItem>
           </apex:pageBlockSection>
         </apex:pageBlock>
         <apex:outputLabel rendered="{!(msc)}" id="Ol" style="text-align:left;font-weight : bold" value="OR"></apex:outputLabel>
         
         
          <apex:outputPanel rendered="{!(!flag)}">
     <a href="/003/e?retURL=%2F003%2Fo&RecordType=0124000000059h2&ent=Contact&con4={!accName}">Create New Contact</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     </apex:outputPanel>
     <apex:outputPanel rendered="{!(flag)}">
<p>     <a href="/{!accountId}">Click here to assign a Main Sales Contact to the Account</a></p>
     </apex:outputPanel>
    <apex:outputPanel >
         <table>
               <tr>
               <td>&nbsp;</td>
               </tr>
               <tr>
               <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
               <input type="button" onclick="JavaScript:getCheckedValue(); return false;"  value="Next"  id="nxt" /></td></tr>
        </table>
    </apex:outputPanel>
  </apex:form>
  <script>
      allradios = document.forms['pg:frm'].sos;
      if(allradios.length){
          allradios[0].checked = false;
      }else{
          allradios.checked = false;
      }     
      
      LUallradios = document.forms['pg:frm'].LUsos;
      if(LUallradios.length){
          LUallradios[0].checked = false;
      }else{
          LUallradios.checked = false;
      } 
      
  </script>
</apex:page>