Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Labelling and valueing a button differently

Status
Not open for further replies.

chrismassey

Programmer
Aug 24, 2007
264
GB
Here is a standard HTML submit button...

Code:
<input type="submit" name="button" value="Button">

The issue I have with this button is that its value is not only the value carried by the form (i.e. $button = param('button'); ) but also the value thats printed on the button itself.

However, the value I use in the script thats carried by the button is entirely different to the value that should be printed on the button. Therefore I tried using this...

Code:
<button type="submit" name="button" value="$_">Button</button>

(Note that $_ is the value that should be carried forward from a loop)...

However the source code of the HTML page that the form prints shows that everything looks correct...

However the value that is carried forward is not $_ but its Button

I am totally confused.

Cheers,

Chris
 
Yes, that is an option. The standard way of doing this is to have a checkbox by each file/folder name and a form button for each action. The file that is checked gets the action performed, like "edit", "move", "rename", etc.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
That is definitely preferable. It allows multiple actions on multiple items.

It has the great advantage of producing a comma-separated list of values for each action.
 
Using multiple forms was the very first idea I had. However, I have to focus carefully on the layout of the HTML page. When using multiple forms, its difficult to layout each form directly beneath each other (remove the <p> gap between forms).

I posted a topic regarding this on the HTML forum...

Although they provided some ideas, I was never able to remove the space. I am not very familiar with using styles.

Chris
 
About using different names for each button. The problem with this is that there could be any number of buttons on the page at any time, therefore the script would have to be able to connect (using $button = param('button')) to an "x" amount of buttons. To keep the page very user friendly, using checkboxes or radio buttons etc is not an option in my case.

Reading brigmars reply again, I have realised you may have meant that it is possible to produce an "x" amount of params to pick up each button?

Chris
 
This isn't perl, but HTML/CSS but the following shows how to remove the margin from the form:
Code:
<html>
  <head>
    <STYLE TYPE="text/css"><!--
      form { margin: 0px; }
      input { width: 10em; }
    --></STYLE>
  </head>
  <body>
    Some text
    Some text
    <form><input type="submit"></form>
    Some text
    <form>blah blah blah<input type="submit"></form>
    <form>blah blah blah<input type="submit"></form>
    Some text
    <form><input type="submit" value="Home"></form>
    <form><input type="submit" value="About"></form>
    <form><input type="submit" value="Contact"></form>
    <form><input type="submit" value="Locations"></form>
    Some text
  </body>
</html>

I also included setting the width of the input buttons to be the same size (10 em); different sized buttons look ugly, IMO.
Of course, with all the filenames you are using, you may want to make them bigger, or remove the size entirely.
 
brigmar you genious!

A perfect solution has been found.

Sorted.

Lots of thank yous to you and Kevin x

Chris
 
the "proper" way to remove the line break from form tags is to change the display type:

<form style="display: inline;">

forms are block level elements so changing them to inline removes the line break. You can modify the margins and padding too also format the display even more.

<edit>
I see you were already advised to use "display: inline". You need to take a crash course in CSS, it is really very easy but there are a lot of formatting rules to learn.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top