Menu label macro

Hi,

Is there any way to set menu labels to global variable?
sc_menu_item gets menu item but i need menu label.

Thanks

sc_script_name might somewhat accomplish your goals (from the help):

This macro is available to the MENU applications to access the application name that was selected in the menu. It allows the user to make dacisions before executing the application if a pre-process is required to that application.

Ex. 1: To clean global variables.
if ({sc_script_name} == “apl1”)
{
sc_reset_global([global1], [global2]);
}

Macro Scope

[table=“width: 100, class: outer_border”]
[tr]
[th]Menu application[/th]
[/tr]
[tr]
[td]onExecute[/td]
[/tr]
[/table]

[QUOTE=hoihoi661;34368]sc_script_name might somewhat accomplish your goals (from the help):

This macro is available to the MENU applications to access the application name that was selected in the menu. It allows the user to make dacisions before executing the application if a pre-process is required to that application.

Ex. 1: To clean global variables.
if ({sc_script_name} == “apl1”)
{
sc_reset_global([global1], [global2]);
}

Macro Scope

[table=“width: 100, class: outer_border”]
[tr]
[th]Menu application[/th]
[/tr]
[tr]
[td]onExecute[/td]
[/tr]
[/table][/QUOTE]

This macro gets app_name. I use this also but i need different one.
Thanks for your answer

Still looking for solution

For now it’s safe to assume there isn’t an easy solution till NetMake implements a macro for this.

You can with JS. Not the best solution, but a solution is.

Can you give me an example code for this?

Many thanks…

1.- Open Tools->Libraries
2.- Create a new library under Public (to use on whatever project you want) called, LibJSAux
3.- Paste this and Save

<?php
	/*
	* Load some useful functions to use on SC
	* Author: Giuseppe @KomencoIT
	* Date: 18/03/2015
	*/
	function loadLibJSAux(){
		echo "<script type=\"text/javascript\">";
	
		loadFunctions();
	
		echo "</script>" ;
	}

	function loadFunctions(){
		echo loadChangeLabel();
	}

	function loadChangeLabel(){
		echo "function changeLabel(domName, text){
			$(domName).text(text);
			}";
	}
?>

4.- Go to the form you want to use this lib.
5.- Enable the lib under Programming->Libraries
6.- Call loader onScriptInit event:

loadLibJSAux();

7.- When you want to change a label call:

sc_ajax_javascript( 'changeLabel', array(SELECTOR, TEXT));

Where SELECTOR is the DOM of your label, and TEXT the text you want to put.

Example.

Should be:

sc_ajax_javascript( 'changeLabel', array("a#sc_b_upd_t", "Update if planets are aligned"));

8.- Enjoy!!

Captura.PNG

I have done all that has been posted by Giu on 03-18-2015, 01:34 PM, but look at the attached screenshots to show the colateral effects: There is an annoying little output screen that emerges when the functions run, despite it works as should do changing the button label when the ajax event onChange is triggered when the user select a different value in the “Responsable” select type field.
How can I avoid the output yellow screen ?

screen1.jpg

screen2.jpg

screen3.jpg

🚀 Scriptcase 9.12 is now available! Check out the new features here 👉🚀 Next Monday (02/24), Scriptcase 9.12 will be released! Check out the new features before anyone else 👉