cancel
Showing results for 
Search instead for 
Did you mean: 

Condition verification in java script on Adobe form.

Former Member
0 Kudos

Hello Experts,

I am using a interactive forma text element on my view. (java web dynpro)

It's a simple application. I am trying to figure out how it works with java script.

I have a text field. which displays employ is sales or production dept

the values in the data view and its the output element of a BAPI which returns XF,TF,HF and XK,JK,HK

(record.dept)

if its XF, TF, HF on the text field in the adobe form should print sales else production.

I have never used java script on adobe form.

I figured the strip above the form in adobe designer is used for java script.

can any one, let me know how I can manipulate. the record value

Here is what I am trying record.dept = XF |TF|JF . but i dont know how to run the java script or its syntax.

Your help is highly appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

chintan_virani
Active Contributor
0 Kudos

James,

Normal Java programming also works in Javascript.So your normal if-else loop will work in javascript as well.

Try this on form:initialize event and change the language to javascript:-


if(record.dept.equalsIgnoreCase("XF") 
             || record.dept.equalsIgnoreCase("TF")
                      record.dept.equalsIgnoreCase("JF"))
{
   xfa.host.messageBox("The value is Sales")
}
else
{
   xfa.host.messageBox("The value is Production")
}

Former Member
0 Kudos

Awesome, I didn't know that. Thanks for your reply.. Whats is xfa.host here?

chintan_virani
Active Contributor
0 Kudos

James,

I am not sure but they should be some internal Adobe objects/API.

Its like you have request object in JSP or wdThis in WebDynpro.

Chintan

Former Member
0 Kudos

Right, but xfa.host.message box just wondering how it would set the value of the particular textfield when I have mutiple.

I have like 5 testfields on my adobe form. One of the text field value need to be set depending on the condition above.

Is there any way we can access using the Id of the text field to the set the value.

if(record.dept.equalsIgnoreCase("XF")

|| record.dept.equalsIgnoreCase("TF")

record.dept.equalsIgnoreCase("JF"))

textfieldid.value to be set.

chintan_virani
Active Contributor
0 Kudos

James,

xfa.host.messageBox should show you an alert dialog box to check data you are getting.

And yes you are right. You can set the value of textfield using code you mentioned.




if(record.dept.equalsIgnoreCase("XF") 
             || record.dept.equalsIgnoreCase("TF")
                      record.dept.equalsIgnoreCase("JF"))
{
   xfa.host.messageBox("The value is Sales");
   <Text-field id>.value = "Sales";
}
else
{
   xfa.host.messageBox("The value is Production");
  <Text-field id>.value = "Production";
}

You can even set the texfields to be readOnly, hide some of them etc. But for that I would suggest you going thru the LiveDesigner help. It would solve most of your doubts :-).

Chintan

Edited by: Chintan Virani on Feb 19, 2008 3:37 PM

Answers (1)

Answers (1)

Former Member
0 Kudos

Write the following javascript funciton on the click event of the Submit button in your Form.

if(this.parent.textfield.rawValue.equalsIgnoreCase("XF") ||

this.parent.textfield.rawValue.equalsIgnoreCase("TF") ||

this.parent.textfield.rawValue.equalsIgnoreCase("JF") ) {

// Your sales print logic goes here

} else {

// your production print logic goes here.

}

Thanks!

Surya.