Jump to content
Larry Ullman's Book Forums

Learning Oop - Setting An Array As A Property And Adding Elements Within The Class


Recommended Posts

Hello,

 

I'm trying to get into OOP and I'm putting together a class to create and validate form inputs/selects/textarea etc.

 

The property I want to create is an array to hold errors. When a validation method fails to validate the posted input it will add an element to the array which is picked up by the method to create the input then add a class and an error message.

 

What I'm stuck on is how to create a property as an array, and how to add elements to that array from within the class. Can anyone point me in the right direction?

 

Maybe I should have started with "hello world"...

 

Cheers,

 

Jon

Link to comment
Share on other sites

 Share

×
×
  • Create New...