Jump to content

2 forms


jimfog

Recommended Posts

I have a page where 2 forms can be depicted-depending on user action.(At any time only one is shown).So, in one page I have to include error checking and validation for each form.On of the forms has more than 8 fields. The result is much code in just only one page-about 280 lines. What would you do?Would you put all this code in one page or split it into other pages as well. Let us forget for a while OOP coding-since I am not good at it. I just wanted to hear views on the matter.

Link to comment
Share on other sites

I would develop the page with the code in the page. When I went into production, I would separate the code into an external script. 280 lines is really not a lot. Byte count is more important because that affects download time. Just as good practice, if there is anyway to avoid repeating code by writing smaller functions, do so. I mean, if 5+ lines of code are exactly the same in multiple places, you could split that off. Sometimes you can do that with code that is similar (not identical) by passing special arguments and possibly true/false switches.

Link to comment
Share on other sites

Yes...what are you saying makes sense(despite the fact in the beginning I was skeptic about it).This a lot of code for going back and forth between different files.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...