You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Robert <ro...@robert.cz> on 2002/09/01 18:57:20 UTC
(Emb)perl & JavaScript
Hi,
I'd like to have a (emb)perl library that would hide the JavaScript
ugliness behind couple of simple Perl calls, but I can't find anything
interesting. Ideally it would work in the Embperl::Form::Validate way,
but offered more advanced stuff like (database) table edit widget,
inteligent date widget, menu tree widget etc. Have anybody heard about
such thing? If not would there be any person interested in using and/or
creating it? Here's an example of what I'm talking about: To edit bigger
part of the (database) table at once, as opposed to the editing it line
by line (eg, editing lines on the invoice), you would write something
like example below (working demo is on
http://www.robert.cz/misc/table-edit-demo.html ). Any comments?
- Robert
PS1 I use something close to the demo code in a real life project and it
seems to work quite fine. Now I want more... ;-)
PS2 You need IE5+ or Moz1+ to view the demo.
============================================================================================================
[-
use TableEdit;
# init table data with DBIx::Recordset or whichever way you want, just
make sure it's array of hashes
# *set = DBIx::Recordset->Search(...);
@set = (
{ id => 101, firstname => 'Gerald', lastname => 'Richter', age =>
'36', country => 'DE' },
{ id => 102, firstname => 'Sherlock', lastname => 'Holmes', age =>
'46', country => 'UK' },
{ id => 103, firstname => 'Robert', lastname => '', age =>
'34', country => 'CZ' },
);
@table_def = (
{ field => 'firstname', title => 'First Name', width => '140', align =>
'left' },
{ field => 'lastname', title => 'Last Name', width => '160', align =>
'right' },
{ field => 'age', title => 'Age', width => '80', default
=> '18', },
{ field => 'country', title => 'Country', width => '90', default
=> 'CZ',
select => [ [ 'CZ', 'DE', 'UK', 'US' ], [ 'Czech Rep.', 'Germany',
'U.K.', 'USA' ] ] },
{ field => 'id', title => 'Id', width => '0' },
if ($req_rec->method eq 'POST') {
@tmp = @{ fdat2rset( \%fdat, \@table_def ) };
foreach $r (@tmp) {
# save data line by line with DBIx::Recordset or whichever way you
want
# $set->Update({ $record }) if $r->{status} eq 'UPDATE';
# $set->Delete({ $record }) if $r->{status} eq 'DELETE';
# $set->Insert({ $record }) if $r->{status} eq 'INSERT';
}
# exit & redirect back to the edit mode
}
-]
<body>
<h1>TableEdit Demo</h1>
<form method=post>
<input readonly onClick='mlAddLine(); return false;' class=mlButton
value='NEW LINE'>
[+ table_edit( \@table_def, \@set ) +]<hr>
<input type=submit class=mlButton value='SAVE FORM'>
</form>
</body>
============================================================================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: (Emb)perl & JavaScript
Posted by Kaare Rasmussen <ka...@kakidata.dk>.
Hi
> > but offered more advanced stuff like (database) table edit widget,
> > inteligent date widget, menu tree widget etc. Have anybody heard about
> > such thing? If not would there be any person interested in using and/or
> > creating it?
I need a database table edit widget - or something closely matching. If
nobody else writes one, I will begin later this fall. But any collaboration
would be appreciated.
> Looks good to me. I use similar things for intranet webservers, where I
> know which browsers the user have.
My requirement is that it will run on any browser, at least in a basic mode.
So I guess I will have to leave out JS.
--
Kaare Rasmussen --Linux, spil,-- Tlf: 3816 2582
Kaki Data tshirts, merchandize Fax: 3816 2501
Howitzvej 75 Åben 12.00-18.00 Email: kar@webline.dk
2000 Frederiksberg Lørdag 11.00-17.00 Web: www.suse.dk
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: (Emb)perl & JavaScript
Posted by Gerald Richter - ecos gmbh <ri...@ecos.de>.
Hi,
>
> I'd like to have a (emb)perl library that would hide the JavaScript
> ugliness behind couple of simple Perl calls, but I can't find anything
> interesting. Ideally it would work in the Embperl::Form::Validate way,
> but offered more advanced stuff like (database) table edit widget,
> inteligent date widget, menu tree widget etc. Have anybody heard about
> such thing? If not would there be any person interested in using and/or
> creating it?
Using it would be cool! For creating I have no time :-(
> Here's an example of what I'm talking about: To edit bigger
> part of the (database) table at once, as opposed to the editing it line
> by line (eg, editing lines on the invoice), you would write something
> like example below (working demo is on
> http://www.robert.cz/misc/table-edit-demo.html ). Any comments?
>
Looks good to me. I use similar things for intranet webservers, where I know
which browsers the user have.
I have a Embperl file that creates forms with some JS support (validate,
hiding parts of the form etc.). In case you start createing such a JS-Perl
lib and like to take a look let me know.
Gerald
P.S. Your demo crashs my german IE5.5 when I click on New Line
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
RE: (Emb)perl & JavaScript
Posted by Wim Kerkhoff <wi...@nyetwork.org>.
Thanks for the link to your table editting demo... A very useful
example.
Check out this site for various DHTML widgets: http://webfx.eae.net/
Wim
> -----Original Message-----
> From: Robert [mailto:robert@robert.cz]
> Sent: Sunday, September 01, 2002 9:57 AM
> To: embperl@perl.apache.org
> Subject: (Emb)perl & JavaScript
>
>
> Hi,
>
> I'd like to have a (emb)perl library that would hide the JavaScript
> ugliness behind couple of simple Perl calls, but I can't find anything
> interesting. Ideally it would work in the Embperl::Form::Validate way,
> but offered more advanced stuff like (database) table edit widget,
> inteligent date widget, menu tree widget etc. Have anybody heard about
> such thing? If not would there be any person interested in
> using and/or
> creating it? Here's an example of what I'm talking about: To
> edit bigger
> part of the (database) table at once, as opposed to the
> editing it line
> by line (eg, editing lines on the invoice), you would write something
> like example below (working demo is on
> http://www.robert.cz/misc/table-edit-demo.html ). Any comments?
>
> - Robert
>
> PS1 I use something close to the demo code in a real life
> project and it
> seems to work quite fine. Now I want more... ;-)
> PS2 You need IE5+ or Moz1+ to view the demo.
>
>
> ==============================================================
> ==============================================
>
> [-
>
> use TableEdit;
>
> # init table data with DBIx::Recordset or whichever way you want, just
> make sure it's array of hashes
> # *set = DBIx::Recordset->Search(...);
> @set = (
> { id => 101, firstname => 'Gerald', lastname =>
> 'Richter', age =>
> '36', country => 'DE' },
> { id => 102, firstname => 'Sherlock', lastname =>
> 'Holmes', age =>
> '46', country => 'UK' },
> { id => 103, firstname => 'Robert', lastname => '',
> age =>
> '34', country => 'CZ' },
> );
>
> @table_def = (
> { field => 'firstname', title => 'First Name', width =>
> '140', align =>
> 'left' },
> { field => 'lastname', title => 'Last Name', width =>
> '160', align =>
> 'right' },
> { field => 'age', title => 'Age', width =>
> '80', default
> => '18', },
> { field => 'country', title => 'Country', width =>
> '90', default
> => 'CZ',
> select => [ [ 'CZ', 'DE', 'UK', 'US' ], [
> 'Czech Rep.', 'Germany',
> 'U.K.', 'USA' ] ] },
> { field => 'id', title => 'Id', width => '0' },
>
> if ($req_rec->method eq 'POST') {
> @tmp = @{ fdat2rset( \%fdat, \@table_def ) };
> foreach $r (@tmp) {
> # save data line by line with DBIx::Recordset
> or whichever way you
> want
> # $set->Update({ $record }) if $r->{status} eq 'UPDATE';
> # $set->Delete({ $record }) if $r->{status} eq 'DELETE';
> # $set->Insert({ $record }) if $r->{status} eq 'INSERT';
> }
> # exit & redirect back to the edit mode
> }
>
> -]
>
>
> <body>
>
> <h1>TableEdit Demo</h1>
>
> <form method=post>
> <input readonly onClick='mlAddLine(); return false;'
> class=mlButton
> value='NEW LINE'>
> [+ table_edit( \@table_def, \@set ) +]<hr>
> <input type=submit class=mlButton value='SAVE FORM'>
> </form>
> </body>
>
> ==============================================================
> ==============================================
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org