Expand my Community achievements bar.

modify form field value

Avatar

Level 2

I have the PDF form with several fields. I want to set the value of one field depending on selection made by the user in other field. I am trying to use if statement but it does not work for me. I have copied below the script I am trying to use.

form1.#pageSet[0].Page1.Table.Table3[0].Row1.Cell1::change - (JavaScript, client)

if (oField.rawValue == "Service Alert")

   this.resolveNode("Cell4").rawValue = "A";

else if (oField.rawValue == "Service Bulletin")

   this.resolveNode("Cell4").rawValue = "B";

When user selects Service Alert in Cell1 I want the value of Cell4 to be set to A and if Service Bulletin is selected I want the value of Cell4 to be set to B.

Can someone help me with the script. I have done a bit of searching and tested verious syntax but nothing did work. I hope someone will help me to have it working.

Regards,


Tony

5 Replies

Avatar

Former Community Member

Hi TonyAus,

Try changing the code to this:

if (oField.rawValue == "Service Alert")

  form1.#pageSet[0].Page1.Table.Table3[0].Row1.Cell4.rawValue = "A";

else if (oField.rawValue == "Service Bulletin")

   form1.#pageSet[0].Page1.Table.Table3[0].Row1.Cell4.rawValue = "B";

Thanks,

VJ.

Avatar

Level 3

I didn't think you could use pound signs in javascript?? Pretty sure you can't, only FormCalc.

In which case,

if (oField.rawValue == "Service Alert") {

   xfa.resolveNode("Cell4").rawValue = "A";

}

else if (oField.rawValue == "Service Bulletin") {

   xfa.resolveNode("Cell4").rawValue = "B";

}

You could also try using a switch statement. This is especially useful if you think you might have more than two values sometime.

var selectionType = oField.rawValue;

switch (selectionType)

{

case "Service Alert":

     xfa.resolveNode("Cell4").rawValue = "A";

     break;

case "Service Bulletin":
     xfa.resolveNode("Cell4").rawValue = "B";

     break;

}

Avatar

Level 2

Thank you very much for your help, but it did not work for me. I have decided to reply and to send you the form. Could you please have a look on what I have done and try to fix it. I want to add action to Cell1 to modify Cell4 in row 1 of the form, top on the blue background.

Regards,

Tony Pluta

Engineering Technical Coordinator / Graphics Designer, Engineering

Rail

16 Broadmeadow Rd | Broadmeadow NSW 2292 | Australia

Direct: +61 2 9492 1277 | Mobile: +61 403 399 167

Fax: +61 2 9462 1383

Email: tony.pluta@ugllimited.com

Web: www.ugllimited.com<http://www.ugllimited.com/>;

Please consider our environment footprint before printing this e-mail

From: GeneveveX

Sent: Thursday, 30 May 2013 3:21 AM

To: Tony Pluta

Subject: modify form field value

Re: modify form field value

created by GeneveveX<http://forums.adobe.com/people/GeneveveX> in LiveCycle Designer - View the full discussion<http://forums.adobe.com/message/5362289#5362289

Avatar

Level 2

Thank you very much for your help, but it did not work for me. I have decided to reply and to send you the form. Could you please have a look on what I have done and try to fix it. I want to add action to Cell1 to modify Cell4 in row 1 of the form, top on the blue background.

Regards,

Tony Pluta

Engineering Technical Coordinator / Graphics Designer, Engineering

Rail

16 Broadmeadow Rd | Broadmeadow NSW 2292 | Australia

Direct: +61 2 9492 1277 | Mobile: +61 403 399 167

Fax: +61 2 9462 1383

Email: tony.pluta@ugllimited.com

Web: www.ugllimited.com<http://www.ugllimited.com/>;

Please consider our environment footprint before printing this e-mail

From: kvdvijaykumar

Sent: Wednesday, 29 May 2013 4:14 PM

To: Tony Pluta

Subject: modify form field value

Re: modify form field value

created by kvdvijaykumar<http://forums.adobe.com/people/kvdvijaykumar> in LiveCycle Designer - View the full discussion<http://forums.adobe.com/message/5360639#5360639

Avatar

Level 3

I would be glad to, but there doesn't seem to be an attachment.