I need help in javascript programming - urgent

Previous topic - Next topic

Willig

Dear Scribus users,

I am developping PDF documents including fields, which should be linked to other fields, and I am not able to perform the javascript programm todo the following task on my own :

I need a first listbox field in which the enduser has to select an option among others. According to this first choice, he would have a second listbox field, in which the different options woud vary according to the response to the first one. Could somebody help me to write the basis of such a programm, as I am not experienced in javascript programming?

Examples of the choice of the first listbox : choiceA  choiceB  choiceC
examples of the second list box : choiceA1 choiceA2 choiceA3 if selected choiceA
choiceB1 choiceB2 choiceB3 if selected choiceB from the first listbox

Thank you so much for your help

I know that there is a specifically dedicated section, but my first post did not excite anybody, so that I try again in the main section of the forum. The tool I am thinking about must be ready by the beginning of the coming week, and i am desperatly stuck!!!!

owencook

Quote from: Willig on April 09, 2011, 07:35:59 PM
Dear Scribus users,

I am developping PDF documents including fields, which should be linked to other fields, and I am not able to perform the javascript programm todo the following task on my own :

I need a first listbox field in which the enduser has to select an option among others. According to this first choice, he would have a second listbox field, in which the different options woud vary according to the response to the first one. Could somebody help me to write the basis of such a programm, as I am not experienced in javascript programming?

Examples of the choice of the first listbox : choiceA  choiceB  choiceC
examples of the second list box : choiceA1 choiceA2 choiceA3 if selected choiceA
choiceB1 choiceB2 choiceB3 if selected choiceB from the first listbox

Thank you so much for your help

I know that there is a specifically dedicated section, but my first post did not excite anybody, so that I try again in the main section of the forum. The tool I am thinking about must be ready by the beginning of the coming week, and i am desperatly stuck!!!!

Does this link help?http://wiki.scribus.net/canvas/How_to_enhance_your_PDF_forms_with_JavaScript

Willig

I already tried this page, but I do not succeed to load a series of different option in the dependant listbox, according to the first listbox choice. The only thing I succeed is to display a unique line as the response of the choide. Coult you help me to modify the following lines of code :
var one = this.getField("sex");
var two = this.getField("names");
if (one.value == 'boy') {
    two.value=[['500'],["600"],["700"]]
} else if (one.value == 'girl') {
    two.value=[['300'],["200"],["100"]]
}

Whatever sepator I use between the options, I retrieve only the first line

With all my thanks