lynx-dev
[Top][All Lists]
Advanced

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

Re: lynx-dev (OT) HTML Button Question


From: Walter Ian Kaye
Subject: Re: lynx-dev (OT) HTML Button Question
Date: Sun, 20 Jan 2002 20:00:56 -0800

At 08:06p -0700 01/20/2002, address@hidden didst inscribe upon an electronic papyrus:

Ok.  Suppose (as in my real case) I have two different submit
buttons, perhaps:

    <input type=submit value="Preview">
    <input type=submit value="Download">

What do I put in the "hidden" input tag(s), and what gets sent
to the server when the user clicks on the "Preview" button or on the
"Download" button.

Well, that won't work for this because you wouldn't know which button had been pressed.

I simply want to be able to decouple the text in the QUERY_STRING sent
to the server from the text appearing at the browser.  I recognize that
I could do this by making "Preview" and "Download" Options in YA
separate Select list and providing a single Submit button, but this
seems cumbersome for the user compared with having two distinct
submittal buttons.

You could "encode" information into the value by padding it with &nbsp; -- pad each button with a different (but balanced) number of them, and then your CGI can count them. That way it won't matter what the text of the button was, because your script will only be looking at the padding around the text.
For example:

  <input type=submit name=act value="&nbsp;Preview&nbsp;">
  <input type=submit name=act value="&nbsp;&nbsp;Download&nbsp;&nbsp;">

I wrote a test script "submit.pl":

  #!/usr/bin/perl

  $x = '&nbsp;Preview&nbsp;';
  $y = '&nbsp;&nbsp;Download&nbsp;&nbsp;';
  $z = '&nbsp;&nbsp;&nbsp;Mail&nbsp;&nbsp;&nbsp;';

  print scalar(split('&nbsp;', $x)), "\n";
  print scalar(split('&nbsp;', $y)), "\n";
  print scalar(split('&nbsp;', $z)), "\n";

I ran it and got this result:

 perl submit.pl
2
3
4


HTH,
-Walter



; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]