From: Nathan D. <na...@ch...> - 2002-09-10 01:27:17
|
The main reason this has not been done is because we didn't want to make too many assumptions about the flow a developer would want to use. The "renderBasicForm()" creates a useful form, but we don't want to assume the elements found there (isNew, id, etc.) will necessarily exist, so we leave it to the user to decide how he/she wants to manage their page flow. A user should, for instance, be able to create their own form by looping through fields in an order they choose and still be able to use everything. As it is, all that needs to happen is to have a value associated with the name of a field -- the user can decide everything else. If they want, they can use the renderBasicForm() to save time, and they can use the example app as a template (it would take just a couple extra lines of code for the sample app to work with ANY contentObject type). With very few (and necessary) exceptions, Modus does not think about "FORM" -- since that may or may not be how a developer chooses to get information into a contentObject instance. The one exception to this right now is in the fields/baseFile.cfc -- since using CFFILE ACTION="Upload" requires a FORM anyway, I figured it was a safe bet to make that assumption, and it was the only way to deal with getting a file into the system and still maintain the same API for a user. Make sense? - Nathan > -----Original Message----- > From: mod...@li... > [mailto:mod...@li...]On Behalf Of Brad Pauly > Sent: Monday, September 09, 2002 4:15 PM > To: mod...@li... > Subject: [Modus-devs] forms and objects > > > Hey All, > > I am just getting the hang of how Modus works, so bear with my > ignorance. I have some thoughts/questions about forms and content > objects. > > I set up the test application then created my own content object called > "event". The first thing I noticed was that I didn't really want to do > all the checking that is done when a content object is created. Granted, > some of this is due to having one page serve as a both "add" and "edit". > However, I would like to be able to do something like: > > <cfscript> > > event = > createObject("component","modustest.contentobjects.event").init(); > > if(isDefined("url.id")) { > event.load(url.id); > } > > if (event.hasErrors()) { > // code to handle errors > } > > </cfscript> > > <cfoutput> > #event.renderBasicForm()# > </cfoutput> > > > I think the object should know if it has been POSTed and do the right > thing. Is it plausible to check for form.id (or form.fieldnames) in the > init function and take care of storing etc there? > > Also, could the id be used to know if an object exists or not? I realize > that the init function is assigning the id. Could this be held off until > later? Perhaps it could be set to 0 or "" in init, then it being nonzero > would signify that it already existed. > > I am guessing much of this has been considered but thought I would > through it out there anyway. > > Brad > > > > ------------------------------------------------------- > This sf.net email is sponsored by: OSDN - Tired of that same old > cell phone? Get a new here for FREE! > https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 > _______________________________________________ > Modus-devs mailing list > Mod...@li... > https://lists.sourceforge.net/lists/listinfo/modus-devs > |