hi all,

  a long time ago, i used to code web pages using webobjects.  this tool has
  a really nice feature that deals with binding object properties to form
  elements.  besides being very elegant, i found this feature to be very
useful in
  several respects:

   (1)  it cleanly separates ui from the data model that represent the state
     of a web application:  you could actually give your epl pages to html
     folks (non programmers) without worrying about them messing up your
code.
   (2) it took care of initializing form elements
   (3) it parses %fdat for you when a form was submitted. it automatically
    distributes fdat's elements to the proper elements within your data
structures
    based on binding/mapping information.

  i wish such a feature were available maybe as an extension to embperl
  (similar to the way embperlobject is currently implemented).

  please allow me to describe how this feature might work in the context of
embperl.
  i am curious to find out whether others in the embperl community might be
interested
  in such a feature:

   1.  all .epl pages would be accompanied by a second file maybe with a
.conf
    extension as illustrated in this example:

pagex.epl:
==========

<HTML>
<BODY>
<FORM>
<EMBPERL NAME="myname">
</FORM>
</BODY>
</HTML>

pagex.conf:
===========
myname:
 type=textfield
 size=20
 name=x
 value=person.name

in the above example, the details of html form elements are abstracted.
the epl file is reduced to a key (myname) that is a reference to an entry in
pagex.conf

at runtime, the embperl engine would translate/merge the above two pages
into:
<HTML>
<BODY>
<FORM>
<INPUT TYPE="TEXT" SIZE="20" NAME="x" VALUE="[+person->name()+]">
</FORM>
</BODY>
</HTML>

when the form is submitted,
 instead of having an fdat hash, one would have objects
 such as 'person', with its name property set to the value
 of $fdat{x}

 in a sense, you create bindings between object properties and
 form elements.  embperl would automatically parse fdat for
 and (1) populate the properties automatically and (2) initialize
 the values of form elements based on values of object properties

  each type of html form element has a variety of documented properties
  that could be specified in the .conf file.

  there are several problems i often see with the epl pages that are
  developed in my environment:
    (1) form elements are often not set to their default values
    (2) values of form elements are often not properly validated when the
form is submitted
    (3) a large portion of an epl page constitutes of manually mapping the
form elements'
      values to properties in respective package or module files.

  i think a solution similar to what i describe above could help.

  here's a link to the webobject reference for this particular feature:
http://developer.apple.com/techpubs/webobjects/System/Documentation/Develope
r/WebObjects/Reference/DynamicElements/Introduction.html

  it also shows many other concepts that i don't describe here such as
specifying formatters
  for text fields for date entries (for example).

  one example of a component is the WOBrowser which i believe corresponds to
a combobox
  (html <SELECT> tag).  note how you can bind an array to the list of
selections.  better yet,
  one ought to be able to bind a hash to the name/value pairs that map to
the <select> tag.
  this would do away entirely with constructs like:
   <SELECT name="s1">
   [$ foreach $key (keys(%selectdat)) $]
   <OPTION VALUE="[+$key+]">[+$selectdat{$key}+]</OPTION>
   [$ endforeach $]
  </SELECT>

  the code would reduce to:
   <EMBPERL NAME="select1">
  the conf file in turn might contain something like:
   select1:
    name=s1
    hash=%selectdat


  if you've made it this far, i would like to thank you for taking the time
to read this message.

/ eitan suez
austin, texas


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to