Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Re: Slightly ugly output

Reply
Thread Tools

Re: Slightly ugly output

 
 
Denis McMahon
Guest
Posts: n/a
 
      08-02-2010
On 01/08/10 23:11, lrhorer wrote:

> This isn't urgent, because the code works, but it is slightly
> unpleasant looking, to me, anyway. I have a page with two radio
> buttons side-by-side. One links to one page and the second to another.
> By my understanding, a single form can only link to a specific page, so
> I created two different forms for the two buttons, each linking to a
> different page, and put them in the same table. Evidently, this is
> causing them to show up with one slightly higher than the other. Now I
> could eliminate the problem by putting them in the same form, linking
> to an intermediate cgi script, and then immediately forwarding to one
> page or the other based upon which button was clicked. Is there a
> cleaner, simpler way, though?


Not sure why you're using radio buttons for this. It sounds like
something you'd normally do with plain links, if there's no other form
data involved. Why not:

<p style="text-align:center">
<a href="handler1" class="btnlink">bing</a>
<a href="handler2" class="btnlink">frog</a>
</p>

using css to make the "btnlink" class look and behave like a button when
clicked etc.

..btnlink {
border: medium outset black;
display: inline-block;
text-decoration:none;
background-color:#dddddd;
padding: 2px 5px;
color: black;
}
..btnlink:active {border: medium inset black;}

If one button is a submit for a form, and the other has to call a
different page, try (with the same css):

<p style="text-align:center">
<span class="btnlink"
onclick="document.getElementById('form_id').submit ()">bing</span>
<a href="handler2" class="btnlink">frog</a>
</p>

This also means you can put the "submit" button outside the form.

Doubtless someone will be along shortly to tell me my css, html or
javascript is horribly broken, but whatever.

Rgds

Denis McMahon
 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      08-02-2010
Denis McMahon wrote:

> <p style="text-align:center">
> <span class="btnlink"
> onclick="document.getElementById('form_id').submit ()">bing</span>
> <a href="handler2" class="btnlink">frog</a>
> </p>
>
> This also means you can put the "submit" button outside the form.
>
> Doubtless someone will be along shortly to tell me my css, html or
> javascript is horribly broken, but whatever.
>


Yes it is, but far worse is that your "solution" *requires* JavaScript
in order to submit the form.

To OP without a URL to what you are attempting it is hard to advise.
Generally if you need a form to have two options that run difference
scripts far better fussing with two form actions but have a single
"frontend" script and have a radio button group with your two options.

<form action="theDecider.cgi">
<div>
Choose: <input type="radio" name="do" value="this"><label>This</label>
or <input type="radio" name="do" value="that"><label>That</label>
<br>
<input type="submit" value"Make it so!">
</div>
</form>


#theDecider.cgi
....
if( param('do') eq 'this' )
{
# call 'this' script
}
elseif ( param('do') eq 'that' )
{
# call 'that' script
}
else
{
# invalid input handle error
}




--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
 
Denis McMahon
Guest
Posts: n/a
 
      08-02-2010
On 02/08/10 04:14, lrhorer wrote:

>> using css to make the "btnlink" class look and behave like a button
>> when clicked etc.
>>
>> .btnlink {
>> border: medium outset black;
>> display: inline-block;
>> text-decoration:none;
>> background-color:#dddddd;
>> padding: 2px 5px;
>> color: black;
>> }
>> .btnlink:active {border: medium inset black;}

>
> That's getting a lot more involved than I want to be. This isn't for a
> commercial application.


It's hardly cutting edge css either.

>> If one button is a submit for a form, and the other has to call a
>> different page, try (with the same css):
>>
>> <p style="text-align:center">
>> <span class="btnlink"
>> onclick="document.getElementById('form_id').submit ()">bing</span>
>> <a href="handler2" class="btnlink">frog</a>
>> </p>

>
> Wouldn't that put them on different lines?


Why would two items in the same <p></p> be on different lines unless (a)
the paragraph wasn't wide enough for both of them or (b) you put a <br>
in between them?

Yes I did try that code out before I posted it.

Rgds

Denis McMahon
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Slightly ugly output rf HTML 25 08-06-2010 08:16 AM
Re: Slightly ugly output Andy HTML 11 08-04-2010 04:34 AM
get output of du / ls command - currently ugly code ... Esmail Python 2 08-13-2009 08:13 PM
The UGLY output from P&S superzooms Rich Digital Photography 34 12-23-2007 09:30 AM
Mozilla Firebird 0.7 has ugly font Nick de Graeve Firefox 1 02-03-2004 05:56 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57