cancel
Showing results for 
Search instead for 
Did you mean: 

Set Screen elements value by jQuery

Former Member
0 Kudos

Hi All,

I am trying to develop Hybrid Workflow app using SUP 2.1.2.

I was wondering, how can we get and set the values to screen elements like input (Edit Box).

I came to an situation where i need to get the value of one Edit Box from one screen and set that value to another Edit Box or Label on other screen.

Can anyone help me, i want to do it using jQuery/HTML....

Your help will be appreciated.

Thanks & Regards

Saket

Accepted Solutions (1)

Accepted Solutions (1)

tahir_z
Contributor
0 Kudos

Hi Saket,

You may try the following code :

Get value from editbox:

var test = $("#<screenName>Form #<editBoxID>").val();

Set to editbox :

var test = "test12";

$("#<screenName>Form #<editBoxID>").val(test);

Regards

Tahir

Former Member
0 Kudos

Thanks Tahir for replying, where can i write this code...i am beginner in jQury.

tahir_z
Contributor
0 Kudos

You can use customAfterNavigateForward for both:

function customAfterNavigateForward(screenKey, destScreenKey) {

var test;

// for the first screen

if(screenKey === "startScreen" && destScreenKey === "firstScreen"){

    test = $("#<screenName>Form #<editBoxID>").val();

}

// for the second screen

if(screenKey === "firstScreen" && destScreenKey === "secondScreen"){

  $("#<screenName>Form #<editBoxID>").val(test);

}

}

Regards

Tahir

Former Member
0 Kudos

Hi Tahir,

I tried your code but field on other screen didnt display the value from fist screen.

I did as following :

Screen and keys and edit box details on screen are as follows:

1. Screens: Start Screen, screenKey:Start_Screen, EbitBox  name: Name, EditBoxID: NameKey

2. Screen : First Screen, ScreenKey: First_Screen.

3. Screen: First Screen Details, ScreenKey:First_Screen_Details

4. Screen: Last Screen, ScrenKey: Last_Screen, EditBox name: newName, EditBoxID:newNameKey

I went to Custom.js file and wrote following code:

function customAfterNavigateForward(screenKey, destScreenKey) {

  var test;

  if(screenKey === "SStart_Screen" && destScreenKey === "First_Screen"){

     test = $("#<Start Screen>Form #<NameKey>").val();

  }

  if(screenKey === "First_Screen_Details" && destScreenKey === "Last_Screen"){

   $("#<Last Screen>Form #<newName>").val(test);

  }

}

Here i am entering value on Start Screen to EditBox:Name = (eg. John)

Now on click of button: 'Show' of start screen it will navigate to 'First Screen' and then 'First Sreen Details',

where i will click on Button : 'Next' and navigate to Last Screen where i am having another EditBox:newName where i want to display value of Name (John).

So i will enter the value on Start Screen and i want to show that value on Last Screen.

while generating package i uncheck the option of 'Generate'.

Please correct me, where i did the mistake.

Thanks & Regards

Saket

tahir_z
Contributor
0 Kudos

Hi Saket,

If you design some part of the application manually then you have to uncheck "Generate" cause it deletes all design and re-create them.

try the following code

function customAfterNavigateForward(screenKey, destScreenKey) {

 

  if(destScreenKey === "Last_Screen"){

       var test = $("#Start_ScreenForm #NameKey").val();

// put an alert make sure u get the value.

       alert(test);

      $("#Last_ScreenForm #newNameKey").val(test);

  }

}

Regards

Tahir

Former Member
0 Kudos

Thanks a Lot Tahir....You are great man...It works.....Thanks a lot.

Do you have any document where i can get help in jquery things related to sup.

tahir_z
Contributor
0 Kudos

You are welcome saket, actually there is no specific document which related to sup. You can find many jquery exapmles on internet.

http://api.jquery.com/

And there is also Sup Apps group which discussing only HWC applications you can find some examples

https://cw.sdn.sap.com/cw/groups/sup-apps

Regards

Tahir ÖZ

Former Member
0 Kudos

Thanks Tahir,

Can you please help me in Server Initiated Workflow app, you have already replied to that discussion of mine post, Please help me to complete that.

http://scn.sap.com/thread/3211729

Thanks & Regards

Saket

Former Member
0 Kudos

Hi Tahir,

I have one query related to jquery,

i have one filed which string (eg.: The Purchase Requisition Number(prnum) is 10000212  ).

So I want to get only the prnum and want to prefix with remaining zeros as per the data length of that field.

eg. prnum = 0010000212  .

so how to cut the sting and padd with zeros.

I have open the new discussion you can reply there.

http://scn.sap.com/thread/3215496

Former Member
0 Kudos

Hi

i try that coding for editbox getting value from one editbox and display it to another editbox...while i try to get value from listview...i coultn't able to get ..in alert box it shows undefined....how to get value from listview...

Regards

sathiya

Former Member
0 Kudos

I dont know why this problem comes...if anyone know plz tell me.......

Former Member
0 Kudos

Hi Sathiya,

Please share more details....

Regards

Saket

Former Member
0 Kudos

Hi Saket

     i just displayed a list of items..normally after cllicking on a list it shows the detail of particular list...instead of it..i was trying to get a value from listview directly and display into editbox which i was creating to display the details of particular list...

For example

xxxx

101

aaaaa

yyyy

102

bbbbb

this is my listview after clicking on particular list it shows the detail view like this..

name : xxxx

number:101

class :aaaaa

instead of it..i had develop my own detail view by creating editbox..i just try to get the value from the listview and show it to the editbox...it's not working

while am getting and just try to display it to alert box..it shows undefined...

Answers (0)