Re: GUI components are disabled

2016-06-13 Thread Alexander Burger
Hi David, Mattias,

> but the +TextField's use +E/R, which connects GUI components to database
> objects. If I am not mistaken, +E/R uses a locking mechanism to stop
> several users from changing objects at the same time. Usually, there is an
> (editButton) involved to allow a user to lock the object, make
> modifications and release the lock once the modifications are done. You can
> find examples of this in the demo app shipped with the PicoLisp
> distribution.
> 
> Try changing these lines:
> 
> (gui '(+E/R +TextField) '(name : home obj) 40 "Name")
> (gui '(+E/R +TextField) '(email : home obj) 40 "Email")
> 
> To this:
> 
> (gui '(+Var +TextField) '*Name 40 "Name")
> (gui '(+Var +TextField) '*EMail 40 "Email")
> 
> This uses a '+Var' prefix class to connect the gui components to a variable
> instead. This variable is used by (newButton) to create a new object.

This is correct.

When, however, David wants to edit DB objects, then the +E/R prefix is
right. But then the 'form' needs an object to be enabled.

The key is to call the 'idObj' function in the form. Usually this is
done in a header like

   ( NIL ( (: nm)))

'' internally call 'idObj' which takes care of handling the DB
objects. Another - more standard - way is to use 'idForm'

   (menu ,"Title"
  (idForm ,"Title" '(chocls) 'nr '+cls T '(may Delete) '((: nr) " -- " (: 
name))
 ... ) )

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


GUI components are disabled

2016-06-13 Thread David Bloom
Hello list,

I'm trying to create a registration form styled with pure.css but all the
fields are disabled for some reason.  Code snippets:

(class +Person +Entity)
(rel id (+Need +Key +Number))  # Unique ID.
(rel name (+Need +Sn +Idx +String))# Name
(rel email (+String))  # Email

[de person-reg ()
  (app)
  (action
 (html 0 "PicoLisp rules" *Css NIL
(viewport-meta-element)
( 60)
   (top-nav)
   ( "content-wrapper"
  ( 'content
 ( 'pure-g
( "l-box-lrg pure-u-3-5 pure-u-md-2-5 pure-u-sm-1"
   #(get (default *ID (val *DB)) 'name)
   (form NIL
  (gui '(+E/R +TextField) '(name : home obj) 40
"Name")
  (gui '(+E/R +TextField) '(email : home obj) 40
"Email")
  (newButton T Dst '(+Person) 'name *Name 'email
*Email) ]

### GUI ##
[de top-nav ()
  ( "header"
 ( "home-menu pure-menu pure-menu-horizontal pure-menu-fixed"
( 'a
   '((href . "!homepage") (class . "pure-menu-heading"))
   "Direct2Dr")
( "pure-menu-list"
   ( "pure-menu-item pure-menu-selected"
  ( 'a
  '((href . "!homepage") (class . "pure-menu-link"))
  "Home") )
   ( "pure-menu-item"
  ( 'a
  '((href . "#") (class . "pure-menu-link"))
  "About") )
   ( "pure-menu-item"
  ( 'a
  '((href . "#") (class . "pure-menu-link"))
  "Contact") )
   ( "pure-menu-item"
  ( 'a
  '((href . "#") (class . "pure-menu-link"))
  "Privacy & Security"]

[de footer ()
  ( "footer l-box is-center" Word to our footer!) ]


In the docs I see that gui is a front-end to new in a get request.  What if
I don't have anyone in the database yet?  How can I create a form which
will take basic info via gui and connect it to the db?  I know I'm missing
something really basic here, please point me in the right direction.  Thank
you all.

-David Bloom