Author Topic: Using Combo box to generate text  (Read 1409 times)

Sean_Fernando

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
  • Scribus User
Using Combo box to generate text
« on: January 07, 2015, 07:36:29 pm »
Hi everyone,

I need some help coming up with the proper javascript code for my interactive form.

I have certain classes in the combo box, such as "Sales", "Clerk", "Temp" and etc. Basically what I want to do is program the text field below the combo box to show a text every time a different class in the combo box is selected. This is probably very easy to do, but I'm a beginner and I have little idea as to how to approach this. Here are my boxes.



I have certain classes in the combo box, such as "Sales", "Clerk", "Temp" and etc. Basically what I want to do is program the text field below the combo box to show a text every time a different class in the combo box is selected. This is probably very easy to do, but I'm a beginner and I have little idea as to how to approach this.

In my textfield I've tried the following javascript with no success:

var one = this.getField("Text57");
var two = this.getField("Polygon101");
if (one.value == 'Sales') {
    two.value='Package A'
}

So here, every time the user selects the "Sales" class in the combo box, I want the text field to read: "Package A". Don't know if this code is right.

Please any help will be appreciated. Thank you. :)
« Last Edit: January 07, 2015, 07:38:09 pm by Sean_Fernando »