Hi,
What is the best way to get the value of a checkbox by the name of “BatchFailed”?
I tried following codes based on JQuery suggestion but all of them return undefined
What is the type of the field? You may post your table schema (CREATE TABLE …) including some records example (INSERT INTO …) so others could comprehend the situation and try straightforward.
Hi, thanks. I can find if it is checked or not with the following command:
$(“#x_BatchFailed”).prop(“checked”)but I can not get the proper value.
$(“#x_BatchFailed”).val()
always return ‘1’ if it is checked or uncheckedCREATE TABLE test (
id int(2) NOT NULL AUTO_INCREMENT,
BatchFailed tinyint(1) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;and it is a checkbox in the PHPMaker with Value=1 Lable=Yes and Value=0 Lable No
Thanks a lot, it is working with your suggestion as the following command:$(“#x_isFailed:checked”).val()I have a similar question for Radio Button. I will write it in a separate reply
Hi again, to get the radio button “MyRadio” for the following sample table:CREATE TABLE test (
id int(2) NOT NULL AUTO_INCREMENT,
isFailed tinyint(1) DEFAULT NULL,
MyRadio int(1) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;it is user defined with the following value, labels: value:1 label:One , value:2 label: two
when I used
$("#x_MyRadio:checked").val()
it returned undefined. I believe $(“#x_MyRadio:checked”) is a correct JQuery selector.
please correct me.
I believe > $(“#x_MyRadio:checked”) > is a correct JQuery selector.
It is incorrect. The “#x_MyRadio” selector only select the first element with that id, you need to select all the radio buttons with “:check” for that field.arbei wrote:
If you want to get the selected value, for example in Edit Page, then simply try this in Startup Script, too:ew.alert("Radio Button selected: " + $(‘#x_MyRadio’).val());