Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2018-02-23 04:09 AM
Hi,
I want to create a button by using Custom Object that does the same work as the "Add New" button for a XREF Field.
I tried to do something like this, but I just got the button, and nothing happened when I clicked on it.
<div style="text-align:center;">
<a class="ContentURL" href="javascript:$('#master_DefaultContent_rts_s4182_f20694c_Add_New').click();">
<img src="../BackgroundImageGenerator.axd?className=StyledButton&classProperties=caption:+++++AddNew+++++;iconSetStyle:VistaRound;baseColor:%23BFDDF5;disabled:False"/>
</a>
</div>
I don't know how to put the "fieldid" - "refmodid" - "moduleid" in the code.
Could anyone help me With this? Thank you!
/Tuan
GhgcdMq8HwHRCWZuqMwEETnAH3l0sBKt8utOGHAgtsY=
2018-03-07 10:10 AM
Thank you David. I customise the button a little bit and it works like magic
2018-03-07 10:11 AM
Jason, the code from David is very good
2018-03-07 10:19 AM
Glad you got it to work!
GhgcdMq8HwHRCWZuqMwEETnAH3l0sBKt8utOGHAgtsY= does great work!
2018-03-07 10:24 AM
Thanks for your code too
2018-03-08 04:28 AM
Hi David Petty,
From the code, I can see that the nummer 20694 is the ID of the XREF field. So what is the nummer 4182 for?
The reason I'm asking is because I'm using different layouts in this application. The code just works for 1 layout, which means I have to change the nummer "4182" so that the code works for other layouts too.
Tuan
2018-03-08 07:55 AM
The 4182 has to do with the section id the field resides in.
You can use wildcard selector to just look for the later half of the id like so
<div style="text-align:center;">
<a class="ContentURL" href="#" onclick="$('[id*=f20694c_Add_New]')[0].click();">
<img src="../BackgroundImageGenerator.axd?className=StyledButton&classProperties=caption:+++++AddNew+++++;iconSetStyle:VistaRound;baseColor:%23BFDDF5;disabled:False"/>
</a>
</div>
Advisory Consultant
2018-03-08 08:28 AM
Thanks.
I tried to do the same with the "Lookup" button but it doesn't work with the wildcard selector:
Old: onclick="javascript:$find('master_DefaultContent_rts_s4182_f2694c').showLookup();" << This works
New: onclick="javascript:$find('[id*=f20694c]').showLookup();" << This doesn't work
How do you think?
2018-03-08 08:53 AM
Referencing the lookup is a little bit more trickier being they've attached a function to the element. You might not be able to do a wildcard selector on it.
Advisory Consultant
2018-03-08 08:54 AM
That's what I guess. Thanks
2018-03-08 09:00 AM
You could try
onclick="$('[id*=f20694c]').find("Lookup")[0].click();"
Advisory Consultant