hi there,
im a php trainee and really need a help in my javascript ..anyone?
i have my code here that injects a patient name ..i need to know if the patient is already injected..if so..it should not be allowed and should pop an alert that say...'sorry the name has already been added'
function AddPatienttoList()
{
//alert('add patient list');
var nametoadd = $('Autopatient_getlist').get('value');
var nameId = $('patient_getlistno').get('value');
if (nameId=='')
{
alert('Cannot Add blank or Name not on List');
return false;
}
var hold = new Element ('div',{'name':'hold'+nameId, 'id':'hold'+nameId});
var optionhold = new Element ('div',{'class':'list', 'style':'display:inline','name':'optionhold', 'id':'optionhold'});
var button = new Element ('input',{'type':'button', 'id':'removepatient', 'value':'X', 'style':'width 128px', 'class':'kwbutton', 'onclick':'RemovePatientfromList('+nameId+')'});
var optioncontent = new Element ('div',{'class':'list', 'style':'display:inline','name':'patientlist', 'id':'patientlist','html':nametoadd});
var optioncontentvalue = new Element ('input',{'type':'hidden', 'value':nameId, 'id':'patientlistvalue[]','name':'patientlistvalue[]'});
optioncontentvalue.inject(hold);
button.inject(optionhold);
optioncontent.inject(optionhold);
optionhold.inject(hold);
hold.inject($('patient_listto'));
$('Autopatient_getlist').value='';
$('patient_getlistno').value='';
}
can anyone help me?
thanks in advance =)