4 Replies Latest reply on May 15, 2013 5:14 PM by marco.delgr

    Populate 2 text fields with a drop-down menu

    marco.delgr

      Hi guys,

       

      I'm very new to PDF scripting and I can't find the solution for this problem:

       

      1) I have a drop-down menu called 'Package' with the options Bronze, Silver, Gold, Platinum

      2) I also have 2 text fields called 'recipients' and 'cost'

       

      I want to be able to populate these two text fields based on the drop-down option selected.

       

       

      Bronze

      recipients = 1000

      cost = 7000

       

      Silver

      recipients = 3000

      cost = 10000

       

      Gold

      recipients = 10000

      cost = 15000

       

      Platinum

      recipients = 50000

      cost = 25000

       

      I'm using the xfa code below but nothing happens when I make a selection in the drop-down menu.

       

      Any clues?

       

       

      var sNewSel = this.boundItem(xfa.event.newText);
      
      
      switch (sNewSel)
      
      {
      
        case "Bronze": 
      
          recipients.rawValue = "1000";
          cost.rawValue = "7000";
      
          break;
      
      
        case "Silver": 
      
          recipients.rawValue = "3000";
          cost.rawValue = "10000";
      
          break;
      
        case "Gold": 
      
          recipients.rawValue = "10000";
          cost.rawValue = "15000";
      
          break;
      
        case "Platinum": 
      
          recipients.rawValue = "50000";
          cost.rawValue = "25000";
      
          break;
      
      
        default: // unknown value -- do nothing
      
          break;
      
      }