This is a discussion on "[SOLVED] Validate Form Class" within the JavaScript Forum section. This forum, and the thread "[SOLVED] Validate Form Class are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
[SOLVED] Validate Form Class
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
[SOLVED] Validate Form Class
Hello, I'm trying to develop a series of classes to validate my webforms, I'll try to explain the idea:
I what to create a HTML form whiteout any javascript event, for example: <form id="form1" name="form1" method="post" action=""> <input type="button" name="button" id="button" value="Button" /> </form> I call the class in the head section (or in external javascript file) For example: var alert=new alert_button('button'); The class alert_button would have a method called onclick For example: alert_button.onclick=function(){ alert('HELLO'); } What I would what to do is when I call var alert=new alert_button('button'); all the methods and properties from alert_button class woud be passed to the object of the element form whit the ID informed (in this case the id button that is from a input element)! This would be very useful because if I what to add a new methods to that elements I would only have to add the method to the class! The problem is that I cant do that passing of methods, I think that the problem is because the object is already instantiated after I try to pass the new methods! (Note that the object type in this case is a input type button, but it could be any type, for example it could be a anchor link). Here is a example of my code:
Thanks for the help! |
|
|
|
||||
|
Re: Validate Form Class
SO you wish to add methods after you have instansiated the object? Or do you want to call all of the methods at the same time as you instansiate the object, I can't quite understand what you mean.
Actually, I think I see what you mean now you want to get the form element by id the add properties and methods to that? If this is the case you could try something like
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
|||
|
Re: Validate Form Class
Thank you Rakuli, it worked 100%
Tks for the help, |
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Validate a form only if certain conditions are met | svennie12 | JavaScript Forum | 2 | May 10th, 2008 14:59 |
| [SOLVED] How to Validate a HTML Contact Form | Xhmtl | Web Page Design | 2 | Dec 9th, 2007 20:11 |
| Div class failing to validate | saracen | Web Page Design | 2 | May 8th, 2007 14:02 |
| validate form | Monie | Classic ASP | 1 | Sep 2nd, 2004 09:06 |
| validate form? | Nick | JavaScript Forum | 10 | Aug 31st, 2004 07:47 |