I am working on a very simple “feedback” type form for my site.  I realize this can be achieved with the collector or other intermediately complex means, but for this site I need something very light weight and simple.  All I need is a table of “Subject”,”Email address” to be read from a file rather than hiding the values in the form.  Basically the method that renders the form reads the file and picks up the subjects to make a drop down, then when submitted it matches the subject to the appropriate email address.  If it’s not a valid subject it drops the request, and only sends email to the right person.  If this were perl on a traditional web server I would have done this in like 60 seconds.  As it is I can’t figure out how to read in the data from the text file so it goes into an array properly.  I was hoping it might be as simple as doing

 

file_name

subject1,email1@host.com

subject2,email2@host.com

subject3,email3@host2.com

 

method

 

… Form header and fields

<select>

 

<dtml-call file_name>

<dtml-in file_name>

    <dtml-let keytosplit=sequence-item

         feedback_name="_.string.split(keytosplit, ',')[0]"

         email_address="_.string.split(keytosplit, ',')[1]">

         <option value=”<dtml-var feedback_name>”><dtml-var feedback_name></select>

  </dtml-let>

</dtml-in>

 

However it treats file_name as a string and won’t let me <dtml-in> over that.  Is there a way to easily convert the contents of the file to a line by line input for a <dtml-in >statement, or some other quick and dirty way to do this?  I’ve come up with some more complex ways with adding a header character to each line to split on, with some form of loop through it all, but turning the other file into a set for <dtml-let> seems to be the most straight forward way to do it.

 

I’ve come up with half a dozen other ways to handle this that include MySQL, or other products, but I really would like it to be as simple as possible with as few external dependencies as possible.

 

---

Allen Brokken

IAT Services - ISAM

University of Missouri

brokkena@missouri.edu