Trevor Borgmeier ->rendorform and displaying errors inline
Feb 29, 2012; 02:40
Trevor Borgmeier
->rendorform and displaying errors inline
I'm relatively new to knop since I've mostly been living in a PHP world the last couple of years (mostly due to pressure from an otherwise good client), but am wanting to edge my way back toward lasso and lasso 9.
Anyway, playing with knop I noticed it couldn't easily (AFAIK) display a field error along with a field. The ToDo list seems to suggest this as well stating that:
->renderform needs a better way to display errors inline together with the fields
Since I wanted this functionality, my first thought was to integrate a new replace method for the template function... So I added this code at line 1361 of the form.inc file (LP8.x version of knop):
> // set field error message if exists... > if: (self -> 'errors') -> type == 'array' && (self -> 'errors') >> > (#onefield -> (find: 'name')); > #renderrow -> (replace: '#error#', ('<span ' + #errorclass + > '>' + (self -> errors -> find(#onefield -> (find:'name')) -> first -> > value) + '</span>')); > else; > #renderrow -> (replace: '#error#', ''); > /if; Now I can do this...
It may not be ideal reusing the #errorclass parameter for both the label and the span, but it's still easy to style them different by targeting them appropriately via css.
label.fielderror span.fielderror
Given I'm new to knop, if I've added anything stupid or overlooked anything please let me know.
Also, what's the process for updating the repository / getting code accepted into the source?
-Trevor
-- ############################################################# This message is sent to you because you are subscribed to the mailing list <knop@lists.montania.se>. To unsubscribe, E-mail to: <knop-off@lists.montania.se> Send administrative queries to <knop-request@lists.montania.se> List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html Project homepage http://montania.se/projects/knop/ Google Code has the latest downloads at http://code.google.com/p/knop/
Feb 29
Steve Piercy - Web Site Builder Re: ->rendorform and displaying errors inline
Feb 29, 2012; 02:38
Steve Piercy - Web Site Builder
Re: ->rendorform and displaying errors inline
Feb 29
Johan Solve Re: ->rendorform and displaying errors inline
Feb 29, 2012; 12:18
Johan Solve
Re: ->rendorform and displaying errors inline
Search
Lasso Programming
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!