[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cgiapp] Javascript to set multiple form params


Yea ...

Id like to know too. I'm now using a lot of very basic, compatible
JavaScript, because it seems to be the only way to do some things without
bloating the CGI world. Here a couple of examples of how I use JavaScript,
that if somebody would like to provide an alternate solution, I would rather
not use:

1. I too have pages with hidden's inside forms. Some of the forms are just
dummy forms used for passing params to another run-mode. For example, I have
many different pages that derive data from MySQL and display data in a
grid-type fashion. On the page there may be a button to add a new record,
and then two buttons for each record; one to delete the record and the other
to delete the record. Each button calls a JavaScript function to set hidden
params, prompt the user, submit the form, etc. The delete record button
submits the current form with params back to the current run-mode and with a
ctrl param set to 'del' and I delete the record. The Add and Edit buttons
submit to a different form (also changing the run-mode) with ctrl params =
'add' and 'edit', respectively and I present a data entry or edit form (each
having a differnet run-mode.) Then these forms submit back to the previous
run-mode for SQL processing. It all works and works pretty well, but if
there's a BETTER way (there's always ANOTHER way,) I'd sure like to know:
I've got a lot of development time wrapped up into the way I'm doing things
now and I played around with more than a few others before deciding on my
current methodology.

2. The other thing I'm using JavaScript for that I can't see doing another
way (without embedding Perl,) is to create dynamic <select> boxes. Ala
Delphi, I use JavaScript to create a hashed datasources in the window object
and attach the <select> boxes to a datasource. Then I can link or chain
together multiple <select> boxes to create record filters and other such
things that don't need the page to reload in order to refine the <option>'s.
So again, if there's a better way, I'd sure like to know.

BTW, as an OT aside, I think we're getting close to a world where
JavaScript/Browser incompatibilities will be a thing of the past. Also, I
remember during the rapid growth days of the WWW, many web sites disclaimed
that you need a specific browser in order to use the site or some such
nonsense. I think for some applications (maybe very few), it's not such a
terrible thing that a client needs a specific browser or version thereof,
thereby forgoing all the idiotic browser/version checking madness. So,
JavaScript does seem to have a place and it certainly doesn't appear to be
going away ... at least until browsers provide Perl interpreters to handle
user events :)

> -----Original Message-----
> From: Dimitris Papaharisis
> [mailto:suppressed
> Sent: Friday, November 07, 2003 8:56 AM
> To: Brett Sanger
> Cc: suppressed
> Subject: RE: [cgiapp] Javascript to set multiple form params
>
>
> Hi bret. I m not the strongest one iether and dont particularly like using
> it but it is the only way I could find to do what I wanted.
>
> I would be more than happy to implement that in my superclass but
> how? Could
> you please provide me with an example of some code?
>
> > -----Original Message-----
> > From: Brett Sanger [mailto:suppressed
> > Sent: 07 November 2003 14:50
> > To: Dimitris Papaharisis
> > Cc: suppressed
> > Subject: Re: [cgiapp] Javascript to set multiple form params
> >
> >
> > On Fri, Nov 07, 2003 at 09:34:22AM -0000, Dimitris Papaharisis wrote:
> > > Hi all. I ve been having problems when I had forms that would
> > have multiple
> > > submit buttons (or links) such as user lists with multiple edit/delete
> > > buttons. Its fine if I wanted to use GETs but I real pain if I
> > used POSTs.
> > >
> > > I have written a little Javascript function that takes the form
> > name as it's
> > > first parameter and key, value pairs of the input field name
> and value I
> > > want to set it to.
> >
> > I'm not strong on my javascript, but that's because I tend to avoid
> > it...it breaks in weird and unpredictable ways between browsers (even
> > when something is labelled as "compatible", the alignment of Venus seems
> > to disturb it), it's a pain to maintain, bloats the pagesize, and
> > doesn't work if they have it turned off or are using any of the new
> > handhelds/smartphones/whatnots that don't support javascript.  (And as
> > an onClick, now your page doesn't work at all)
> >
> > So could you tell me if this is any different that embedding a similar
> > function in your CGI::App subclass?
> >
> > --
> > SwiftOne  /  Brett Sanger
> > suppressed
> >
>
>
> ---------------------------------------------------------------------
> Web Archive:  http://www.mail-archive.com/suppressed/
>               http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
> To unsubscribe, e-mail: suppressed
> For additional commands, e-mail: suppressed
>
>


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.