Skip to main content
Participant
June 28, 2023
Question

type: "check_box" Return value undefined

  • June 28, 2023
  • 1 reply
  • 338 views

Hi,

 

I coded a Javacript window with different items that fill in elements of form that is used as a stamp. Textboxes and radio buttons are working fine, however I'm struggling with retrieving the Check box informatio: Console says undefined. Here is the relevant piece of code:

// Dialog Definition 
var oDlg = 
	{
	strchkPaid: "False",
	
	initialize: function(dialog) 
		{ 
	    dialog.load
			(
			{
			"chkPaid":this.strchkPaid,
			}
			); 
		},
        commit: function(dialog) 
		{ 
            var data = dialog.store();
			this.strchkPaid= data["chkPaid"];
		},
        description:
		{ 
			name: "Refacturation",
			elements: 
			[
				{ 
				type: "view",
				elements: [
					{
						item_id: "chkPaid",
						name: "Payé par carte de crédit",
						type: "check_box",
					},	
				] 
				},
			] 
		}
};

// Dialog Activation 
app.execDialog(oDlg)
if((event.source.forReal)&&(event.source.stampName == "#EtampeTI"))
{
if(oDlg.strchkPaid){this.getField("chkBoxPaid").value = "Yes";}else{this.getField("chkBoxPaid").value = "No";}
}

oDlg.strchkPaid seems to return undefined.

 

Any ideas?

 

Thanks in advance.

 

This topic has been closed for replies.

1 reply

Participant
June 28, 2023

Found it while posting. Thanks to Karl Heinz Kremer : Item Ids can only have four letters, the corresponding ID for this field is "sdNum" - and therefore five characters long.

try67
Community Expert
Community Expert
June 28, 2023
Also, the value of the field is a boolean, not a string.