Scribus Forums

Scribus => PDF Generation => Topic started by: Sean_Fernando on January 07, 2015, 07:36:29 pm

Title: Using Combo box to generate text
Post by: Sean_Fernando 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.

(http://i1274.photobucket.com/albums/y432/uthum876/1_zps4a7b7ecf.jpg) (http://s1274.photobucket.com/user/uthum876/media/1_zps4a7b7ecf.jpg.html)

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. :)