By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,825 Members | 2,437 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,825 IT Pros & Developers. It's quick & easy.

Checkbox problem

P: n/a
Dear All,

Please assist me for below code :
What i need is -> One "Patient Master" form for online Entry :
My AIM -> When somebody want to add new patient a parent form will open

than finally he typed patient id " jakap " and press tab button than a
new pop window will
open and finally displays all name / id starts with " ja " when user
will click on any of patient using checkbox corresponding to his name
and id then all pop up form values like his name, last name , id and
dob will be autocomplete in parent form this already i've achieved but
i am facing problem when single record will be there in popup window at
that moment parent form is not filled by popup values because length is
coming undefined :
My function is accepting field parameter which checkbox name (pt_id)
and popup window
will generate list of input named first_name1,last_name2, dob1, pt_id
and if rows are more than one series will keep on move.

Javascript code as follows :

function transfer_values(field)
{
var len = new Array(field.length);
for (i = 0; i < field.length; i++)
{
var topic_id = new Array(field.length);
for (i = 0; i < field.length; i++)
if (field[i].checked == true)
{
//alert(field[i].id + field[i].value)
topic_id[i]=(field[i].id);
len[i]=(field[i].value);
//alert ("This is params value :" + (topic_id[i]));
//alert(topic_id[i]);
//alert("This is len :"+len[i]);
///////////////////////////
self.opener.document.forms[0].elements['x_insurance1'].value =
self.document.forms[0].elements['ins_id'+len[i]].value
//self.opener.document.forms[0].elements['x_last_name'].value =
self.document.forms[0].elements['last_name'+len[i]].value
//self.opener.document.forms[0].elements['x_first_name'].value =
self.document.forms[0].elements['first_name'+len[i]].value
//self.opener.document.forms[0].elements['x_dob'].value =
self.document.forms[0].elements['dob'+len[i]].value
//self.opener.document.forms[0].elements['x_deductible'].focus();
self.window.close()

}
}
}

Jan 4 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
When there is just one element checked in checkbox group then you can
check directly for its value..
Something like this..
if( ! (field.length)) {
alert(field.value);
}

--Sunil P/

Jan 5 '06 #2

P: n/a
Thanks Sunil for help i'll try it now...

Jan 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.