Re: [htmltmpl] Re: [Comment] H::T => using <TMPL_UNLESS> to trigger <TMPL_LOOP>
Brought to you by:
samtregar
From: Puneet K. <pk...@ei...> - 2004-05-09 14:44:45
|
On May 9, 2004, at 9:25 AM, C Hagstrom wrote: > >> >No, but you're misunderstanding the tree structure. The entire >> >loop.../loop needs to be within the unless.../unless. > > I think I understand that part of the structure ... what I was trying > to do was call the template one of two ways ... the first > using the loop functionality to populate the form, or the second, > where it pulls in the cgi variables being passed to populate the form. > > In other words, I have an editing form for a DB record. When > I first call the form, the script makes a DB call for a given record, > stuffs the info from the record into an array, and then using > <TMPL_LOOP> the template displays the populated form. > > After reviewing the info, making a change, and then "submitting" > the form, I want the script to be able to perform error checking, and > if > there is an unacceptable value being passed, I'd like to use > the same form, but the fields would be populated with the > cgi parameters just passed, and the error message displayed > next to the field with the unacceptable value. > .. > > That said, I'm up for any suggestions on improving the approach > since you asked for suggestions on improving the approach, my suggestion would be to not use H-T/Perl for this at all. Use JavaScript. I am assuming that you are using the cgi params to send back in case errors are found because you are not using any db work for error checking. If that is the case, check it _before_ the user submits the form. JavaScript is a great language with wonderful capabilities, and checking at the user end insures that you don't have unnecessary traffic at all. Of course, one argument would be "what if the user has js turned off...?" well, then.... don't use my suggestion. |