HighDots Forums  

forms and w3c validation - A question

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss forms and w3c validation - A question in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
forums.macromedia.com
 
Posts: n/a

Default forms and w3c validation - A question - 08-01-2004 , 05:37 AM






Hi there,

I left a message here yeasterday about problems in validating a form.

Well I have now managed to squish most of the bugs I had but one that won't
seem to go away if the 'form name' error that produces the following error:

Line 72, column 13: there is no attribute "name"

<form name="city_form" method="post" action="index.php" id="city_form"
class="



The thing is that I can take away the form name and rely on just the ID and
it will validate but I need the form name for some scripting to call this:
onchange="document.city_form.submit()"

So does anyone know why this would fail?

This is the code for the form:

<form method="post" action="index.php" id="city_form" name="city_form"
class="clearer">
<div class="row">
<span class="label"><label for="city">Please select City:</label></span>
<span class="formw">
<select name="city" onchange="document.city_form.submit()" id="city"
onfocus="this.style.background='#fff';"
onblur="this.style.background='#eee';">
<option value="">Please select one</option>
<?
for ($i=0;$i<sizeof($cities);$i++) {
print "<option";
if ($_POST['city']==$cities[$i])
print " selected";
print ">".$cities[$i]."</option>\n";
}
?>
</select>
<? print " <input type=\"hidden\" name=\"business_category\"
value=\"$_POST[business_category]\" />"; ?>
<? print " <input type=\"hidden\" name=\"business_sub_cat\"
value=\"$_POST[business_sub_cat]\" />"; ?>
<input type="hidden" name="PHPSESSID" value="<?php echo session_id(); ?>"
/>
</span>
</div>
</form>



Thanks for any guidance

Michelle





Reply With Quote
  #2  
Old   
Julian Roberts
 
Posts: n/a

Default Re: forms and w3c validation - A question - 08-01-2004 , 05:55 AM






Try onchange="this.form.submit()"

--
Jules
http://www.charon.co.uk/charoncart
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004



Reply With Quote
  #3  
Old   
Dan Vendel *GOF*
 
Posts: n/a

Default Re: forms and w3c validation - A question - 08-01-2004 , 06:05 AM



forums.macromedia.com wrote:
Quote:
Hi there,

I left a message here yeasterday about problems in validating a form.

Well I have now managed to squish most of the bugs I had but one that won't
seem to go away if the 'form name' error that produces the following error:

Line 72, column 13: there is no attribute "name"

Odd. I placed the code in a simple html doc and ran it throught the W3C
validator using various doctypes, but never got that particular error.

Which DTD are you using? Can we see the entire page (or at least the
code). Another hunch: Perhaps the validator only want letters in the
"name", i.e. not the underscore?

--
Dan Vendel - *GOF*
Contact: http://www.proformica.com/en/contact.shtml
Formmail tutorial: http://www.proformica.com/en/formmail_tutorial.shtml
Nested tables: http://www.proformica.com/en/nested_table_demo.shtml
SEO: http://www.proformica.com/en/search_engine_optimization.shtml
SE Utility: http://www.proformica.com/en/advanced_web_ranking.shtml
Search Dreamweaver newsgroup: http://www.proformica.com/google.html


Reply With Quote
  #4  
Old   
forums.macromedia.com
 
Posts: n/a

Default Re: forms and w3c validation - A question - 08-01-2004 , 06:07 AM



Thanks for that - It did the trick

You have no idea how long I spent trying to fix that



Reply With Quote
  #5  
Old   
forums.macromedia.com
 
Posts: n/a

Default Re: forms and w3c validation - A question - 08-01-2004 , 12:34 PM



Hi Dan,

This is my complete form area.


<!-- Start of form DIV-->
<div id="contactForm">

<form method="post" action="index.php" id="city_form" class="clearer">
<div class="row">
<span class="label"><label for="city">Please select City:</label></span>
<span class="formw">
<select name="city" onchange="this.form.submit()" id="city"
onfocus="this.style.background='#fff';"
onblur="this.style.background='#eee';">
<option value="">Please select one</option>
<?
for ($i=0;$i<sizeof($cities);$i++) {
print "<option";
if ($_POST['city']==$cities[$i])
print " selected";
print ">".$cities[$i]."</option>\n";
}
?>
</select>
<? print " <input type=\"hidden\" name=\"business_category\"
value=\"$_POST[business_category]\" />"; ?>
<? print " <input type=\"hidden\" name=\"business_sub_cat\"
value=\"$_POST[business_sub_cat]\" />"; ?>
<input type="hidden" name="PHPSESSID" value="<?php echo session_id(); ?>"
/>
</span>
</div>
</form>

<?
if (($_POST['city'])&&($_POST['city']!="Please select one")) {
print "<form method=\"post\" action=\"index.php\"
id=\"business_category_form\" class=\"clearer\">";
print "<div class=\"row\"><span class=\"label\"><label
for=\"business_category\">Please select Business Category:</label></span>";
print "<span class=\"formw\">";
print "<select name=\"business_category\" onchange=\"this.form.submit()\"
id=\"business_category\" onfocus=\"this.style.background='#fff';\"
onblur=\"this.style.background='#eee' \" />";
print "<option>Please select one</option>";
for ($i=0;$i<sizeof($categories);$i++) {
print "<option";
if ($_POST['business_category']==$categories[$i])
print " selected";
print ">".$categories[$i]."</option>\n";
}
print "</select>";
print "<input type=\"hidden\" name=\"city\" value=\"$_POST[city]\" />";
print "<input type=\"hidden\" name=\"business_sub_cat\"
value=\"$_POST[business_sub_cat]\" />";
print "</span>";
print "</div>";
print "</form>";
}

if (($_POST['city'])&&($_POST['city']!="Please select
one")&&($_POST['business_category'])&&($_POST['business_category']!="Please
select one")) {
print "<form method=\"post\" action=\"index.php\"
id=\"business_category_form_type\" class=\"clearer\">";
print "<div class=\"row\"><span class=\"label\"><label
for=\"business_category_type\">Please select Business Category
Type:</label></span>";
print "<span class=\"formw\">";
print "<select name=\"business_sub_cat\" onchange=\"this.form.submit()\"
id=\"business_sub_cat\" onfocus=\"this.style.background='#fff';\"
onblur=\"this.style.background='#eee' \" />";
print "<option>Please select one</option>";
for ($i=0;$i<sizeof($cats);$i++) {
print "<option";
if ($_POST['business_sub_cat']==$cats[$i])
print " selected";
print ">".$cats[$i]."</option>\n";
}
print "</select>";
print "<input type=\"hidden\" name=\"city\" value=\"$_POST[city]\" />";
print "<input type=\"hidden\" name=\"business_category\"
value=\"$_POST[business_category]\" />";
print "</span>";
print "</div>";
print "</form>";
}
?>


<?
if (($_POST['business_category'])&&($_POST['business_category']!="Please
select
one")&&($_POST['business_sub_cat'])&&($_POST['business_sub_cat']!="Please
select one")) {

print "<p>Directory entries for
<strong>$_POST[business_sub_cat]&nbsp;$_POST[business_category]</strong> in
<strong>$_POST[city]</strong>:</p>\n";

$result = mysql_query("SELECT * FROM jobs WHERE city = '$_POST[city]' AND
business_category = '$_POST[business_category]' AND business_sub_cat =
'$_POST[business_sub_cat]'");

while ($row = mysql_fetch_array($result)) {
print "<p><strong>$row[company_name]</strong><br /><br />\n";
print "$row[overview] <br /><br />\n";
print "Address: $row[address] <br />\n";
print "Telephone: $row[tel] <br />\n";
print "Fax: $row[fax] <br />\n";
if ($row['email']!="")
print "Email: <a href=\"mailto:$row[email]\">$row[email]</a> <br />\n";
else
print "Sorry no email address <br />";
if ($row['website']!="")
print "Website: <a href=\"$row[website]\">$row[website]</a> <br/>\n";
else
print "Sorry no website <br /></p>";
if ($_SESSION['loggedIn'])
print "<p><a
href=\"add.php?n=edit&id=$row[id]&business_category=$row[business_category]\">Edit
Details of the above listing</a></p>";
}

}
?>

<p><a href="#" onclick="javascript:ScrollWin.scroll('0'); return
false;">Back to top of page</a></p>

<div class="clearer"></div>

</div><!-- We close the Form DIV -->



Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.