Hi
In a few cases, mostly when linking to other apps, SC can (if setup on the link) add its own buttons to the linked app’s toolbar.
I am interested in 2 specific cases of this.
The first is the “Add New” button. This appears when setting “Display button (new row) on the grid toolbar” to Yes in the source Grid’s “application” link settings - see the 2 images below…
The second case is where you have a form and one of the fields is a SELECT field with lookup settings. Those lookup settings allow you (if you want to) to link to another app to change that lookup source data (add / modify etc). When run this shows itself by putting an “Edit” button next to the field’s dropdown - see images below.
Now - the question (at last!):
How can I find where to change those 2 buttons text values to something other “Add New” / “Edit”?
Now, before you all come running lots of suggestions - just read on a bit more so you can see what I’ve tried…
There does not appear any configuration settings that will do this. So I first looked to see if there were language options and found things like lang_btns_neww - changing these in an event (or within the languages screen itself) didn’t (seem) to make a difference to those specific buttons.
So I looked to see if there was a clue in the generated code, or inspecting the buttons in a browser console. I couldn’t see much in the generated code, but using the browser inspector I found (for the “Add New” button):
<a href="javascript: nm_gp_submit1('/scriptcase/app/Timesheets/form_projecthours/','/scriptcase/app/Timesheets/grid_tblprojecthours/', 'projhoursid*scin9*scoutrecord_user*scinahelman*scoutrecord_tsid*scin7*scoutNM_cancel_insert_new*scin1*scoutnmgp_opcao*scinnovo*scoutNM_btn_insert*scinS*scoutNM_btn_new*scinS*scoutNM_btn_update*scinS*scoutNM_btn_delete*scinS*scoutNM_btn_navega*scinN*scoutsc_redir_insert*scinok*scout', '_blank'); return false;" id="sc_b_new_top" onclick="nm_gp_submit1('/scriptcase/app/Timesheets/form_projecthours/', '/scriptcase/app/Timesheets/grid_tblprojecthours/', 'projhoursid*scin9*scoutrecord_user*scinahelman*scoutrecord_tsid*scin7*scoutNM_cancel_insert_new*scin1*scoutnmgp_opcao*scinnovo*scoutNM_btn_insert*scinS*scoutNM_btn_new*scinS*scoutNM_btn_update*scinS*scoutNM_btn_delete*scinS*scoutNM_btn_navega*scinN*scoutsc_redir_insert*scinok*scout', '_blank'); return false;; return false;" class="scButton_default" title="Add New" style="vertical-align: middle; display:inline-block;" onmouseover="if(this.disabled){ return false; }else{ main_style = this.className; this.className = 'scButton_onmouseover'; }" onmouseout="if(this.disabled){ return false; }else{ this.className = main_style; }" onmousedown="if(this.disabled){ return false; }else{ this.className = 'scButton_onmousedown'; }" onmouseup="if(this.disabled){ return false; }else{ this.className = 'scButton_onmouseover'; }">Add New</a>
YUCK! Still, I wanted to see if I could use it somehow. So I used a heredoc approach (otherwise way too much escaping needed to build it as an echo string) in onApplicationInit (changing just the text at the end from Add New to Blah Blah) to see if I could replace the existing button with newly named one. Bear in mind I am not an HTML or Javascript expert by any means - but I’m always willing to try hacking to see what happens
echo <<<ADZEOT
<a href="javascript: nm_gp_submit1('/scriptcase/app/Timesheets/form_projecthours/', '/scriptcase/app/Timesheets/grid_tblprojecthours/', 'projhoursid*scin9*scoutrecord_user*scinahelman*scoutrecord_tsid*scin7*scoutNM_cancel_insert_new*scin1*scoutnmgp_opcao*scinnovo*scoutNM_btn_insert*scinS*scoutNM_btn_new*scinS*scoutNM_btn_update*scinS*scoutNM_btn_delete*scinS*scoutNM_btn_navega*scinN*scoutsc_redir_insert*scinok*scout', '_blank'); return false;" id="sc_b_new_top" onclick="nm_gp_submit1('/scriptcase/app/Timesheets/form_projecthours/', '/scriptcase/app/Timesheets/grid_tblprojecthours/', 'projhoursid*scin9*scoutrecord_user*scinahelman*scoutrecord_tsid*scin7*scoutNM_cancel_insert_new*scin1*scoutnmgp_opcao*scinnovo*scoutNM_btn_insert*scinS*scoutNM_btn_new*scinS*scoutNM_btn_update*scinS*scoutNM_btn_delete*scinS*scoutNM_btn_navega*scinN*scoutsc_redir_insert*scinok*scout', '_blank'); return false;; return false;" class="scButton_default" title="Add New" style="vertical-align: middle; display:inline-block;" onmouseover="if(this.disabled){ return false; }else{ main_style = this.className; this.className = 'scButton_onmouseover'; }" onmouseout="if(this.disabled){ return false; }else{ this.className = main_style; }" onmousedown="if(this.disabled){ return false; }else{ this.className = 'scButton_onmousedown'; }" onmouseup="if(this.disabled){ return false; }else{ this.className = 'scButton_onmouseover'; }">Blah Blah</a>
ADZEOT;
And this is what you get - which is not what I wanted as it’s simply an extra button - but it is cool in that it puts the button AWAY from toolbar which could be useful for something else one day (??):
So - if anyone has a (hopefully simple) way to change the text on those automatic SC buttons then I’d love to hear from you. NetMake - in both those cases an extra text box in the appropriate dialog to provide your own text would be the easiest (for the user).
Thanks for reading (sorry it was a bit long).
Adz