PDA

View Full Version : [DUPLICATE] fieldset with checkboxToggle - how to verify if it is checked/unchecked?



kevin-berry
28 Jun 2010, 8:50 AM
When a form is submitted, I want to determine if my checkboxToggled fieldset (id: parent_sub_id) is checked or not. I have tried using getDom, but to no avail. Here is the code for the form itself:

Ext.BLANK_IMAGE_URL = 'ext-3.2.1/resources/images/default/s.gif';

var backendURL='tng_create_form_code.php';

Ext.namespace('kberry_create_form');

kberry_create_form.app = function()
{
Ext.onReady(function(){

//quicktips shows validation errors and tips, I assume on the 'side'
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';

var Parent_Sub_ID =
{
xtype:'fieldset',
checkboxToggle:true,
title: 'Parent Submission ID',
name: 'parent_sub_id',
id: 'parent_sub_id',
autoHeight:true,
collapsed: true,
items : [{
xtype:'textarea',
fieldLabel: 'Auxiliary Text',
name: 'pid_aux_text',
id: 'pid_aux_text',
height:75,
width:400,
autoScroll:true,
emptyText: 'If left blank, Auxiliary Text defaults to \"Please leave this field blank ' +
'if you do not wish to link this submission with a previously made submission.\"',
}, pid_rank, pid_searchable,
]
}


var default_buttons =
[{
text: 'Create Form',
handler: function()
{
var form_name = Ext.getCmp('form_name').getValue();
alert("You are attempting to create a form called " + form_name);
var col = Ext.getDom('parent_sub_id').collapsed
alert("PID: " + col);
var post_params = "ajax_action=check_form_name&form_name=" + form_name;
create_http_request();
alert("Sending request...");
send_http_request(handler_check_form_name, "POST", target_url, post_params);
}

}];

///
///THE FORM
///

var fp = new Ext.form.FormPanel
({
frame:true,
applyTo: 'content',
name: 'create_form_form',
id: 'create_form_form',
items: [
{
layout:'column',
border:false
},
Parent_Sub_ID,
], //end items
buttons: default_buttons
}); //end actual form creation

}); //end onReady
}(); //End of namespace

When the user clicks the submit button, I try to do a check to see if the parent_sub_id checkToggle is indeed on or off:


var col = Ext.getDom('parent_sub_id').collapsed
alert("PID: " + col);col, however, returns 'undefined', despite the fact that my fieldset has the id "parent_sub_id".
If that checkbox is checked, I need it to return true, or if not, false.

Can anyone provide a suggestion as to why it's not behaving that way?



Thanks for your suggestions.

Kevin