Jump to content

How do I check the input field arrays


Darghon

Recommended Posts

I have a form with several tabs, the tabs are all identical but represent data from different environments.

so the text fields have names like date_approved[16] representing the date_approved for environment 16.

 

Now I want to generate input checks for all tabs, so I generate checks like the following, but they don't work, any solutions?

 

//frm is a passed variable that contains the document.form
if(frm.prod_apprby[16].value != "" && frm.prod_dtappr[16].value == ""){
			alert("Env 16: Production Approved by can not be filled in if date approved is blank.");
			return false;
		}

 

Thx in advance

Link to comment
https://forums.phpfreaks.com/topic/156076-how-do-i-check-the-input-field-arrays/
Share on other sites

document.form was not what frm stood for,

 

to be more detailed, frm was => document.frmRequest

so frm.prod_apprby[16] was => document.frmRequest.prod_apprby[16]

where "prod_apprby[16]" was the name of a field in the form

 

I managed to solve this with the following statement:

 

document.getElementsByName("prod_apprby[16]")[0].value

 

This would give me the value of that field, and not an undefined error like the previous attempt did.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.