on 05-27-2021 10:56 PM
Hi All,
I have buttons BUTTON_A, BUTTON_B, BUTTON_C. Each having certain onClick scripts if the buttons are clicked.
And there then there is an "Apply" button. On the onClick event of the "Apply" button, inside the script I want to check a condition and then click the buttons from the script.
//inside of "Apply" button onClick event script
if(cond 1){ //cond denotes some condition
BUTTON_A.click(); //so that whatever script is present inside this button gets run.
}else if(cond 2){
BUTTON_B.click();
}
When I checked the ctrl+space option after button name, I could not find the function which could possibly click on the button manually. I can enter the whole button script in the "Apply" button script itself but that's seems to be a savage way.
Please appreciate your guidance on the above as well as please so let me know if I'm missing anything !
Hi Bhuvan,
calling scripts from several places is what “Script Functions” are for.
Let’s say that BUTTON_A does something that "creates an item" and BUTTON_B "renames an item".
In the "Technical components" of the "Outline" view in Lumira Designer you should create a “Global Scripts Object” that you could call “ITEM_FUNCTIONS”. In that Scripts Object you could then create script functions “createItem” and “renameItem”.
Instead of putting the logic for creating an item or renaming an item into the scripts of "BUTTON_A" and "BUTTON_B", you put the logic into these script functions. The script of “BUTTON_A” would then be simply calling this function:
ITEM_FUNCTIONS.createItem();
In that flow you mentioned, you can then also call these functions, depending on the condition, like so:
if (myCond1) {
ITEM_FUNCTIONS.createItem();
} else if (myCond2) {
ITEM_FUNCTIONS.renameItem();
}
Hope that helps.
Best regards, Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Martin:D , thank you very much for advice, worked like a charm ! This definetely will make my life easier.
User | Count |
---|---|
74 | |
8 | |
8 | |
8 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.