cancel
Showing results for 
Search instead for 
Did you mean: 

How check a "Check Box"?

Former Member
0 Kudos

Hello,

I am trying the next:

If I have the check box selected return the birthday in a textfield.

If I have not the check box selected return "nothing"

************************************************************************

var check = session.findbyid("wnd[0]/usr/boxpersonas_40/chkpersonas_46").selected; // to know if the check box is selected

Go to transaction and get the value // OK

var birth = session......................................

Return to main screen // OK

session.findbyid("wnd[0]/usr/boxpersonas_40/chkpersonas_46").selected = check;  // to activate o desactivate the check box, I think that after press the button the checkbox is always NOT SELECTED.

if (check == "true")

     {

          session.findbyid("wnd[0]/usr/boxpersonas_40/txtpersonas_51").text = birth;

     }

else

     {

          session.findbyid(wnd[0]/usr/boxpersonas_40/txtpersonas_51").text = "Nothing";

     }

Thanks!!!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Asier,

It is a challenge to make a global var stored correctly via UI flows. The reason your test is not working could be that your global var also lost its value. Pls do check it first before using it - I will store the value liek args.val before calling other tocde, and after coming back, I can press a test btn to display the global var value is a tmp textbox to see if the value is maintained (I guess it is not in your case). By this way you are 100% sure that global var is working or not. Then, you have to try some ways - in Personas 2.0, I notcied that the "global" values stored in args.val does not always working - but if all your actions are performed inside one main script button which calls a lot other buttons or do tcode, then the value is maintained when come back and you can do check in teh same btn. You can alsso write the value into a hidden text field in some screen as a tmp backup and read it at some other time as a hack. Try it anyway.

Hope this helps you.

Dong

Former Member
0 Kudos

Let's simplifly the code:

var check = session.findById("wnd[0]/usr/chkPersonas_1").selected;

session.findById("wnd[0]/tbar[0]/okcd").text = "su01";

session.findById("wnd[0]").sendVKey(0);

session.findById("wnd[0]/tbar[0]/btn[3]").press();

session.findById("wnd[0]/usr/chkPersonas_1").selected = check;

Always the value of check is FALSE.

I am stuck with this problem.

0 Kudos

Hi Asier,

I am not sure what you want to do with the script.

From SMEN you are going to SU01 and then coming back and pasting into the same checkbox.

Are you saying that when you select your checkbox, run your script, then your checkbox is unchecked??

Regards,

Sushant

Former Member
0 Kudos

Yes, Always is unchecked after run the script.

In the middle I only put the code for go to su01 and come back. // It's only an example

0 Kudos

ok. then its a bug.

With YOUR above script, if you select a checkbox, it should remain checked

if you uncheck, it should remain unchecked.

I tried in my system with updated kernel patch (117) and Personas installation (note 2050325),

I do not see this behavior.

Thanks,

Sushant

Former Member
0 Kudos

Thanks, must be a bug.

There are more bugs. For example if I put a field like "Read Only" doesn't work. Or If I change a theme, after saving, If I enter again to the flavour the Theme is lost and I need to check it again. I can edit tables but after saving the changes are not saving...

0 Kudos

I think you need to update your system. Both the things were most likely fixed.

I would recommend you to update both kernel patch and personas. If you are still able to reproduce, then create an OSS.

If you are part of Personas 3.0 ramp up phase, you can send me your email. I will add you to our jam group where we make all these announcements about releases for Personas 3.0, so that you remain on top of things!!

Regards,

Sushant

Carifaine
Active Participant
0 Kudos

Did you implement all the relevant notes mentioned in 2050325 as Sushant suggested? Seems like you missed something out here.

Nevertheless you could try to store your variable in the sessionstorage via javascript. I'm not sure though if Screen Personas supports it.

Former Member
0 Kudos

I am using a test machine with release "300" and level "0000", I am going to ask to the administrator to upgrade it.

What is the latest level?

0 Kudos

latest kernel patch you see in service market place. I think its 117 right now.

For personas, notes mentioned in note 2050325

Sushant

Former Member
0 Kudos

Without updating your system (of course it would be nice if possible to do so), a workround can bedoing this:

window.myCheckStatus="checked" or "unchecked".

You can change this value in any flavor no matter where you go and back as long as the window is not closed, this value remains. Then you can paste this value to a textbox or check if in JS. I am sure you can restore the check status when coming back. Try it.

Hope this helps. Thanks.

Dong

0 Kudos

hi dong,

i would not recommend you to use window object if you are planning to use Personas 3.0 later as your flavor will break when rendering in other GUIs...

Regards,
Sushant

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello,

The main problem that I am having, is that when I return to the main screen the checkbox is always unselected.

Do you know how can I solved the problem?

Carifaine
Active Participant
0 Kudos

Hey,

what exactly do you want to achieve? Do you want to have the check box selected as default or do you want to select it, execute your script and have it selected when your script returns to your main screen again?

I think it is possible to store your variable "check" in a "global storage" so the script has the value available when you return to your main screen. I just can't check the command for this right now.

Former Member
0 Kudos

Hi,

I want to press the button and if the checkbox is selected, after press the script button appears selected, and if it is unselected, after press the script button appears unselected.

First I save the varible "check"

After go to the transaction and return to the main screen, a return the value of the variable "check" to the check box but doesn't work.

Can you help me with the javascript code?

Carifaine
Active Participant
0 Kudos

Hi Asier,

stupid question but i gotta ask this: Did you debug your script to make sure your variable "check" contains a value at the point you want to select your checkbox? Is this a single script or are there any steps in between that could manipulate the checkbox during execution?

Regards,

Christoph

Former Member
0 Kudos

Hello,

It's not an stupid question, but I don't know how to debug it.

I press F12 in google chrome but I can not find the code of my stript in .js that appears in the menu.

Carifaine
Active Participant
0 Kudos

Hi,

use the javascript command 

     debugger;

in your script and press f12 before you execute your script. The debugger should jump right into your script where you put the command.

Former Member
0 Kudos

I can use that to check the time response, but I don't know, how to check for example the value of one varible using that debugger tool.

Carifaine
Active Participant
0 Kudos

Normally its shown by mouseover as you can see here: Debugging options in Personas 3.0 - SAP Imagineering - SCN Wiki

0 Kudos

Hi Asier,

Please see the following link:

Debugging options in Personas 3.0 - SAP Imagineering - SCN Wiki

Regards,

Sushant

Former Member
0 Kudos

Hi,

When you go to a new transaction to get the birthday and back, the local UI settings (ie previous ckecked or unchecked status) is simply lost (thus it is always as Unchecked). I guess you have to store the previous "check status" globally.  Does this help? Thanks.

Dong

Former Member
0 Kudos

Hello Dong,

Thanks for the answer, I supposed that and for that reason I check or unchecket it again before write the birthday in the textbox.

But still not working.