Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- fix up a form
June 13, 2010, 4:50 am
rate this thread
I have a question about this form. I need to add the closing tags
without messing it up. For the radio button is the value "yes". I
need to put the zone number and zone Id on the same input line even
though there are two fields. Is that possible? The reason is the two
fields need to be concatenated together to form one search criteria
and it would be easier for the user to do input on both those fields
on the same line.
echo "<table align='center' style='border:1px solid $CCCCCC;'>\n";
echo "<th align='right'>BU\n";
echo "<td><select name='search_bu'>\n";
echo "<th align='right'>Cart ID\n";
echo "<td><input type'text' name='search_cart_id' size='10'
echo "<th align='right'>Zone ID\n";
echo "<td><input type'text' name='search_zone_id' size='9'
echo "<th align='right'>Zone Num\n";
echo "<td><input type'text' name='search_zone_num' size='9'
echo "<th align='right'>NDC\n";
echo "<td><input type'text' name='get_ndc' size='10' class='txt1'>
echo "<th align='right'>Error Flag\n";
echo "<td><input type='radio' name='get_error_flag' class='rad1'
value ='yes' >Yes\n";
echo "<td colspan='13' align='center'><input type='submit'
Re: fix up a form
It's not a form, it's some code (PHP?) that is expected to generate some
markup inside a form - it doesn't even generate the form element's start and
end tags. You should have posted the URL, as that would have let us see what
is really being generated. Now we can just see that probably invalid markup
is being generated - e.g., <input type'text' ... lacks an equals sign.
A lone radio button is a _bad_ idea. Radio buttons are pack animals. You
probably want to use a checkbox instead, though I can't see what the text
"Error Flag" (presumably meant to be a label for the input field, though not
properly marked up with <label>) is supposed to tell the user.
I don't think you do.
Of course. Just don't put them into two different rows of a table.
So why don't you just make them one input field?
But if they are read as two fields, then general accessibility and usability
considerations imply that each should appear on a line of its own. Otherwise
you would need to use awkward markup if you wanted to use <label> markup
<tr><th align='right'>Zone <label for='search_zone_id' title='Zone
<label for='search_zone_num' title='Zone number'>Num</label><th>
<input type='text' name='search_zone_id' id='search_zone_id' size='9'
<input type='text' name='search_zone_num' id='search_zone_num' size='9'
Re: fix up a form
It looks like you've provided code used to generate your HTML
content. Perhaps it is a CGI script?
In any case, you need to mentally separate the CGI (or whatever
you're using to generate the HTML content) from the HTML content.
Once you decide on the final HTML content you want your application
to serve, then you can make appropriate changes to your CGI source
to generate it.
Rather than showing the CGI source here, show the HTML.
If you don't know of any better way to get it, browse to your
page and then do a Save Page As (or whatever your browser provides)
to save it to a file.
Also, as you're just trying to learn basics, start by creating a simple
test page which does what you want. Once you learn what you're trying
to learn, you can apply it to your real application.