Copy link to clipboard
Copied
Hello,
i have a problem with my JavaScript.
I Created a Stamp witth 11 Fields, which have to be Filled see here:
My Problem is now that it works only for the first 9 Fields(var name str1...str11 in Code)
I just noticed that it only works vor all str1-str9 if i go higher with 2 digits str10 it dont works anymore...
Any idea how i can solve it to fill more then just 9 Fields?
Great Thanks.
This is how my pop-up window looks like:
After entered the Data:
Here is my Code:
var FormRouting = {
return: 'cancel',
DoDialog: function() {
return app.execDialog(this);
},
str1: '',
str2: '',
str3: '',
str4: '',
str5: '',
str6: '',
str7: '',
str8: '',
str9: '',
str10: '',
str11: '',
initialize: function(dialog) {
var dlgInit = {
str1: this.str1,
str2: this.str2,
str3: this.str3,
str4: this.str4,
str5: this.str5,
str6: this.str6,
str7: this.str7,
str8: this.str8,
str9: this.str9,
str0: this.str10,
str0: this.str11,
};
dialog.load(dlgInit);
},
commit: function(dialog) {
var oRslt = dialog.store();
if (oRslt) {
this.str1 = oRslt['str1'] || '';
this.str2 = oRslt['str2'] || '';
this.str3 = oRslt['str3'] || '';
this.str4 = oRslt['str4'] || '';
this.str5 = oRslt['str5'] || '';
this.str6 = oRslt['str6'] || '';
this.str7 = oRslt['str7'] || '';
this.str8 = oRslt['str8'] || '';
this.str9 = oRslt['str9'] || '';
this.str10 = oRslt['str10'] || '';
this.str11 = oRslt['str11'] || '';
}
},
description: {
titlename: "Kontierung", align_children: "align_left", width: 500, height: 400, elements:
[
{ // Text Fields
type: "cluster", name: "Data Entry", align_children: "align_left", elements:
[
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "MD"
},
{
item_id: "str1", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "Kreditor"
},
{
item_id: "str2", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "SachkontoRow1"
},
{
item_id: "str3", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "SachkontoRow2"
},
{
item_id: "str4", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "SachkontoRow3"
},
{
item_id: "str5", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "NettoBetragRow1"
},
{
item_id: "str6", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "NettoBetragRow2"
},
{
item_id: "str7", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "NettoBetragRow3"
},
{
item_id: "str8", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "OPKostenstelleRow1"
},
{
item_id: "str9", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "OPKostenstelleRow2"
},
{
item_id: "str10", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "OPKostenstelleRow2"
},
{
item_id: "str11", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
]
},
{
alignment: "align_right",
type: "ok_cancel",
ok_name: "OK",
cancel_name: "Cancel"
}
],
},
};
if (event.source.forReal && event.source.stampName == "#Abrechnung") {
if ('ok' == FormRouting.DoDialog()) {
// String fields
this.getField('MD').value = FormRouting.str1;
this.getField('Kreditor').value = FormRouting.str2;
this.getField('SachkontoRow1').value = FormRouting.str3;
this.getField('SachkontoRow2').value = FormRouting.str4;
this.getField('SachkontoRow3').value = FormRouting.str5;
this.getField('NettoBetragRow1').value = FormRouting.str6;
this.getField('NettoBetragRow2').value = FormRouting.str7;
this.getField('NettoBetragRow3').value = FormRouting.str8;
this.getField('OPKostenstelleRow1').value = FormRouting.str9;
this.getField('OPKostenstelleRow2').value = FormRouting.str10;
this.getField('OPKostenstelleRow2').value = FormRouting.str11;
}
}
Copy link to clipboard
Copied
item_id allows only 4 characters.
Copy link to clipboard
Copied
item_id allows only 4 characters.
Copy link to clipboard
Copied
Thanks for that info.
i just changed them to 4 in my code.... but it then just takes the first 10.... not the last one:
md01: '',
kred: '',
sko1: '',
sko2: '',
sko3: '',
nbt1: '',
nbt2: '',
nbt3: '',
kst1: '',
kst2: '',
kst3: '',
See image:
Is it somehow limited to max. 10 ids or smt???
when i try to use more then 10 the last ones stays empty....
Copy link to clipboard
Copied
No, it is not limited to 10. Did you change the id's throughout your code, whereever they appear?
Copy link to clipboard
Copied
Yes i changed them all, here is the code:
I Cant find any mistake....
Also how i can change a Text field to a drop down menu, where i can enter something by myself or chose something from the dropdown menu?
Is there somewhere a Explanation or smt for all the reserved placeholdernames like "edit_text" etc??
var FormRouting = {
return: 'cancel',
DoDialog: function() {
return app.execDialog(this);
},
md01: '',
kred: '',
sko1: '',
sko2: '',
sko3: '',
nbt1: '',
nbt2: '',
nbt3: '',
kst1: '',
kst2: '',
kst3: '',
initialize: function(dialog) {
var dlgInit = {
md01: this.md01,
kred: this.kred,
sko1: this.sko1,
sko2: this.sko2,
sko3: this.sko3,
nbt1: this.nbt1,
nbt2: this.nbt2,
nbt3: this.nbt3,
kst1: this.kst1,
str0: this.kst2,
str0: this.kst3,
};
dialog.load(dlgInit);
},
commit: function(dialog) {
var oRslt = dialog.store();
if (oRslt) {
this.md01 = oRslt['md01'] || '';
this.kred = oRslt['kred'] || '';
this.sko1 = oRslt['sko1'] || '';
this.sko2 = oRslt['sko2'] || '';
this.sko3 = oRslt['sko3'] || '';
this.nbt1 = oRslt['nbt1'] || '';
this.nbt2 = oRslt['nbt2'] || '';
this.nbt3 = oRslt['nbt3'] || '';
this.kst1 = oRslt['kst1'] || '';
this.kst2 = oRslt['kst2'] || '';
this.kst3 = oRslt['kst3'] || '';
}
},
description: {
titlename: "Kontierung", align_children: "align_left", width: 500, height: 400, elements:
[
{ // Text Fields
type: "cluster", name: "Daten Eingabe", align_children: "align_right", elements:
[
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "MD"
},
{
item_id: "md01", type: "edit_text", alignment: "align_right", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "Kreditor"
},
{
item_id: "kred", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "Sachkonto Zeile 1"
},
{
item_id: "sko1", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "Sachkonto Zeile 2"
},
{
item_id: "sko2", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "Sachkonto Zeile 3"
},
{
item_id: "sko3", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "NettoBetrag Zeile 1"
},
{
item_id: "nbt1", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "NettoBetrag Zeile 2"
},
{
item_id: "nbt2", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "NettoBetrag Zeile 3"
},
{
item_id: "nbt3", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "OPKostenstelle Zeile 1"
},
{
item_id: "kst1", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "OPKostenstelle Zeile 2"
},
{
item_id: "kst3", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "OPKostenstelle Zeile 3"
},
{
item_id: "kst3", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
]
},
{
alignment: "align_right",
type: "ok_cancel",
ok_name: "OK",
cancel_name: "Cancel"
}
],
},
};
if (event.source.forReal && event.source.stampName == "#Abrechnung") {
if ('ok' == FormRouting.DoDialog()) {
// String fields
this.getField('MD').value = FormRouting.md01;
this.getField('Kreditor').value = FormRouting.kred;
this.getField('SachkontoRow1').value = FormRouting.sko1;
this.getField('SachkontoRow2').value = FormRouting.sko2;
this.getField('SachkontoRow3').value = FormRouting.sko3;
this.getField('NettoBetragRow1').value = FormRouting.nbt1;
this.getField('NettoBetragRow2').value = FormRouting.nbt2;
this.getField('NettoBetragRow3').value = FormRouting.nbt3;
this.getField('OPKostenstelleRow1').value = FormRouting.kst1;
this.getField('OPKostenstelleRow2').value = FormRouting.kst2;
this.getField('OPKostenstelleRow2').value = FormRouting.kst3;
}
}
Copy link to clipboard
Copied
ok found my mistake.... was just blind
But how i can do a drop down menu?
Copy link to clipboard
Copied
Here's your mistake:
str0: this.kst2,
str0: this.kst3,
For a dropdown, in the dialog description:
type: "popup"
You also have to load an object with the popup items like this:
function (dialog)
{dialog.load({
//item ID next line
pop1:
{
"A": -1,
"B": -1,
"C": -1
}
})

