function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JTecJTec 

Onchange in lookup field

Hi,

We are developing a SControl that use a custom field with lookup this is the code:
Code:
<td class="data2Col" style="width:82%;border-bottom:1px solid #E3DEB8">
    <input id="camp_lkid" type="hidden" value="000000000000000" name="camp_lkid" onchange ="cargarEstados();" />
 <input id="camp_lkold" type="hidden" value="" name="camp_lkold" />
 <input id="camp_lktp" type="hidden" value="701" name="camp_lktp"/>
 <input id="camp_lspf" type="hidden" value="0" name="camp_lspf"/>
 <input id="camp_mod" type="hidden" value="0" name="camp_mod"/>
 <span class="lookupInput">
  <input id="camp" type="text" value="" tabindex="2" size="20" onchange="getElementByIdCS('camp_lkid').value='';getElementByIdCS('camp_mod').value='1';"   name="camp" maxlength="255"/>
  <a id="camp_lkwgt" title="Campaña" tabindex="2" onclick="setLastMousePosition(event);" href="JavaScript: openLookup('/_ui/common/data/LookupPage—lkfm=editPage&lknm=camp&lktp=' + document.getElementById('camp_lktp').value,670,document.getElementById('camp_mod').value,'&lksrch=' + escapeUTF(document.getElementById('camp').value));">
  <img alt="Buscar" src="{!Scontrol.JavaArchive}"/>
  </a>
 </span>
</td>

 Our problem is when the value search is inserted. The onchange of the input camp_lkid don't work.

Is there any problem in the code? is it no posible to use onchange in the camp_lkid field? How can we captured this event?

Thanks for all.

werewolfwerewolf
Where are you trying to put this Scontrol?
JTecJTec
Thanks for reply,

We are using this SControl in a new page, we are replacing the "new" bottom target of a object for our SObject.


werewolfwerewolf
And you're trying to hack the standard lookup page to work with your Scontrol?  That's ambitious.  At the very least you'll have to match all the fields that that page is looking for (there are 3, I forget what they are but do a search on this forum on lkid and you'll probably find the others). 

Also, lookup pages are changing pretty fundamentally, and your hack is not guaranteed to work forever, so be forewarned.