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!

first form field problem

Status
Not open for further replies.

BB101

Programmer
May 23, 2001
337
GB
I have a form, and this form has lots of fields, text, check and select boxes. This form normally posts fine and everything is great, but occasionally, a particular account will stop the first field on the form from being submitted with the rest of the data.

Also, when I load the page, I have a script which loops through all the elements in the form; and I can clearly see the first field in that list!

Can anyone help, explain, theoryise?

I'm stumped.

--BB
 
A code ur using will be usefull to answer ur query.

--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
There is rather a lot of it and I didn't want to paste it all. Here's a snipet of the form:

Code:
    <form method=post name="details" action="aprofile.php?id=<?=$_GET['id'] ?>" enctype="multipart/form-data">
    <td width="80%" valign="top"> 
      <table height="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
        <tr> 
          <td width="33%" valign="center" align="center">&nbsp;</td>
          <td width="33%" height="123" valign="center" align="center"><a href="via.php"><img src="images/logo3.gif" width="250" height="113" border="0"></a><p>
          <div align="center" style='font-family: Arial, Helvetica, sans-serif;'><font color="#FF0000"><strong><span class="heading">
            Your <?=$town ?> Profile<br><img src='images/blank.gif' width=1 height=5><br>
          </span></strong></font></div>
          </td>
          <td width="33%" valign="bottom">&nbsp;</td>
        </tr>
        <tr valign="top"> 
          <td colspan="3">
            <table border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td valign="top">
                  <div align="center" style='font-family: Arial, Helvetica, sans-serif;'><font color="#FF0000">
              <table border="0" cellpadding="0" cellspacing="1" class="maintext">
                <tr>
                  <td height="20"<?=((isset($err['firstname']) && $err['firstname']) ? " style='color: #FF0000'" : "") ?>><font face="Verdana, Arial, Helvetica, sans-serif">First name</font></td>
                  <td height="20"><input name="firstname" type="text" id="firstname" fdep="show_name" onBlur="showF();"<?=(isset($ud['firstname']) ? " value='".$ud['firstname']."'" : "") ?>></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td height="20"<?=((isset($err['surname']) && $err['surname']) ? " style='color: #FF0000'" : "") ?>><font face="Verdana, Arial, Helvetica, sans-serif">Last name</font></td>
                  <td height="20"><input name="surname" type="text" id="surname" fdep="show_name" onBlur="showF();"<?=(isset($ud['surname']) ? " value='".$ud['surname']."'" : "") ?>></td>
                  <td align=right>
                    <nobr>Show name in Profile<input type=checkbox name="show_name" value="1"<?=((isset($ud['surname']) && isset($ud['show_name']) && $ud['show_name'] == "1") ? " checked" : "") ?> onClick="depC();"></nobr>
                  </td>
                </tr>
                <tr>
                  <td height="20"><font face="Verdana, Arial, Helvetica, sans-serif"<?=((isset($err['trading_name']) && $err['trading_name']) ? " style='color: #FF0000'" : "") ?>>Trading name</font></td>
                  <td height="20"><input name="trading_name" type="text" id="trading_name" fdep="show_trading_name" onBlur="showF();"<?=(isset($ud['trading_name']) ? " value='".$ud['trading_name']."'" : "") ?>></td>
                  <td align=right>
                    <nobr>Show in Profile<input type=checkbox name="show_trading_name" value="1" onClick="depC();"<?=((isset($ud['trading_name']) && isset($ud['show_trading_name']) && $ud['show_trading_name'] == "1") ? " checked" : "") ?>></nobr>
                  </td>
                </tr>
                <tr>
                  <td height="20"<?=((isset($err['expertise']) && $err['expertise']) ? " style='color: #FF0000'" : "") ?>><font face="Verdana, Arial, Helvetica, sans-serif">Business activity <img style='cursor: help;' onMouseOver="showAlt(this, 'jobtitle')" onMouseMove="showAlt(this, 'jobtitle')" onMouseOut="hideAlt(this, 'jobtitle')" src="images/info.gif" align=absbottom></font></td>
                  <td height="20"><input name="expertise" type="text" id="expertise" fdep="show_expertise" onBlur="showF();"<?=(isset($ud['expertise']) ? " value='".$ud['expertise']."'" : "") ?>></td>
                  <td align=right>
                    <nobr>Show business activity in Profile<input type=checkbox name="show_expertise" value="1" onClick="depC();"<?=((isset($ud['expertise']) && isset($ud['show_expertise']) && $ud['show_expertise'] == "1") ? " checked" : "") ?>></nobr>
                  </td>
                </tr>
                <tr>
                  <td height="20"<?=((isset($err['expert_address1']) && $err['expert_address1']) ? " style='color: #FF0000'" : "") ?>><font face="Verdana, Arial, Helvetica, sans-serif">Address Line One</font></td>
                  <td height="20"><input name="expert_address1" type="text" id="expert_address1" fdep="show_address" onBlur="showF();"<?=(isset($ud['expert_address1']) ? " value='".$ud['expert_address1']."'" : "") ?>></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td height="20"<?=((isset($err['expert_address2']) && $err['expert_address2']) ? " style='color: #FF0000'" : "") ?>><font face="Verdana, Arial, Helvetica, sans-serif">Address Line Two</font></td>
                  <td height="20"><input name="expert_address2" type="text" id="expert_address2" fdep="show_address" onBlur="showF();"<?=(isset($ud['expert_address2']) ? " value='".$ud['expert_address2']."'" : "") ?>></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td height="20"><font face="Verdana, Arial, Helvetica, sans-serif"><nobr>Address Line Three (optional)</nobr></font></td>
                  <td height="20"><input name="expert_address3" type="text" id="expert_address3" fdep="show_address" onBlur="showF();"<?=(isset($ud['expert_address3']) ? " value='".$ud['expert_address3']."'" : "") ?>></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td height="20"<?=((isset($err['expert_town']) && $err['expert_town']) ? " style='color: #FF0000'" : "") ?>><font face="Verdana, Arial, Helvetica, sans-serif">Town/City</font></td>
                  <td height="20"><input name="expert_town" type="text" id="expert_town" fdep="show_address" onBlur="showF();"<?=(isset($ud['expert_town']) ? " value='".$ud['expert_town']."'" : "") ?>></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td height="20"<?=((isset($err['expert_county']) && $err['expert_county']) ? " style='color: #FF0000'" : "") ?>><font face="Verdana, Arial, Helvetica, sans-serif">County</font></td>
                  <td height="20"><input name="expert_county" type="text" id="expert_county" fdep="show_address" onBlur="showF();"<?=(isset($ud['expert_county']) ? " value='".$ud['expert_county']."'" : "") ?>></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td height="20"<?=((isset($err['expert_postcode']) && $err['expert_postcode']) ? " style='color: #FF0000'" : "") ?>><font face="Verdana, Arial, Helvetica, sans-serif">Postcode</font></td>
                  <td height="20"><input name="expert_postcode" type="text" id="expert_postcode" fdep="show_address" onBlur="showF();"<?=(isset($ud['expert_postcode']) ? " value='".$ud['expert_postcode']."'" : "") ?>></td>
                  <td align=right><nobr>Show address in Profile<input type=checkbox name="show_address" value="1" onClick="depC();" <?=((isset($ud['expert_address1']) && isset($ud['show_address']) && $ud['show_address'] == "1") ? " checked" : "") ?>></nobr></td>
                </tr>
                <tr>
                  <td height="20"<?=((isset($err['phone']) && $err['phone']) ? " style='color: #FF0000'" : "") ?>><font face="Verdana, Arial, Helvetica, sans-serif">Telephone number</font></td>
                  <td height="20"><input name="phone" type="text" id="phone" fdep="show_telephone_number" onBlur="showF();"<?=(isset($ud['phone']) ? " value='".$ud['phone']."'" : "") ?>></td>
                  <td align=right>
                    <nobr>Show telephone in Profile<input type=checkbox name="show_telephone_number" value="1" onClick="depC();" <?=((isset($ud['phone']) && isset($ud['show_telephone_number']) && $ud['show_telephone_number'] == "1") ? " checked" : "") ?>></nobr>
                  </td>
                </tr>
                <tr>
                  <td height="20"<?=((isset($err['mobile']) && $err['mobile']) ? " style='color: #FF0000'" : "") ?>><font face="Verdana, Arial, Helvetica, sans-serif">Mobile number</font></td>
                  <td height="20"><input name="mobile" type="text" id="mobile" fdep="show_mobile_number" onBlur="showF();"<?=(isset($ud['mobile']) ? " value='".$ud['mobile']."'" : "") ?>></td>
                  <td align=right>
                    <nobr>Show mobile in Profile<input type=checkbox name="show_mobile_number" value="1" onClick="depC();" <?=((isset($ud['mobile']) && isset($ud['show_mobile_number']) && $ud['show_mobile_number'] == "1") ? " checked" : "") ?>></nobr>
                  </td>
                </tr>
                <tr>
                  <td height="20"<?=((isset($err['email']) && $err['email']) ? " style='color: #FF0000'" : "") ?>><font face="Verdana, Arial, Helvetica, sans-serif">Email address <img src='images/info.gif' align=absmiddle style='cursor: help;' onMouseOver="showAlt(this, 'email')" onMouseMove="showAlt(this, 'email')" onMouseOut="hideAlt(this, 'email')"></font></td>
                  <td height="20"><input name="email" type="text" id="email" fdep="show_email_address" onBlur="showF();"<?=(isset($ud['email']) ? " value='".$ud['email']."'" : "") ?>></td>
                  <td align=right>
                    <nobr>Show email in Profile<input type=checkbox name="show_email_address" value="1" onClick="depC();" <?=((isset($ud['email']) && isset($ud['show_email_address']) && $ud['show_email_address'] == "1") ? " checked" : "") ?>></nobr>
                  </td>
                </tr>
                <tr>
                  <td height="20"<?=((isset($err['website']) && $err['website']) ? " style='color: #FF0000'" : "") ?>><font face="Verdana, Arial, Helvetica, sans-serif">Website address</font></td>
                  <td height="20"><input name="website" type="text" id="website" fdep="show_website_address" onBlur="showF();"<?=(isset($ud['website']) && $ud['website'] != "" ? " value='".$ud['website']."'" : " value='[URL unfurl="true"]http://'")[/URL] ?>></td>
                  <td align=right>
                    <nobr>Show website in Profile<input type=checkbox name="show_website_address" value="1" onClick="depC();" <?=((isset($ud['website']) && isset($ud['show_website_address']) && $ud['show_website_address'] == "1") ? " checked" : "") ?>></nobr>
                  </td>
                </tr>
                <tr>
                  <td height="20"<?=((isset($err['logo']) && $err['logo']) ? " style='color: #FF0000'" : "") ?>><font face="Verdana, Arial, Helvetica, sans-serif">Upload Logo (optional) <img src="images/info.gif" align=absbottom style='cursor: help;' onMouseOver="showAlt(this, 'logo')" onMouseMove="showAlt(this, 'logo')" onMouseOut="hideAlt(this, 'logo')"></font></td>
                  <td height="20" colspan="2"><input name="logo" type="file" onChange="previewLogo(this.value);"><input type=hidden name="logo_path"<?=(isset($ud['logo_path']) ? " value='".$ud['logo_path']."'" : "") ?>> <input type=button value="Remove" style='height: 22;' onClick="previewLogo('images/dummylogo.gif'); document.forms['details'].logo_path.value = ''; document.forms['details'].logo.outerHTML = '<input name=logo type=file onChange=previewLogo(this.value)>';"></td>
                </tr>
                <tr>
                  <td height="20"<?=((isset($err['photo']) && $err['photo']) ? " style='color: #FF0000'" : "") ?>><font face="Verdana, Arial, Helvetica, sans-serif">Upload Photo (optional) <img src="images/info.gif" align=absbottom style='cursor: help;' onMouseOver="showAlt(this, 'logo')" onMouseMove="showAlt(this, 'logo')" onMouseOut="hideAlt(this, 'logo')"></font></td>
                  <td height="20" colspan="2"><input name="photo" type="file" onChange="previewPhoto(this.value);"><input type=hidden name="photo_path"<?=(isset($ud['photo_path']) ? " value='".$ud['photo_path']."'" : "") ?>> <input type=button value="Remove" style='height: 22;' onClick="previewPhoto('images/dummylogo.gif'); document.forms['details'].photo_path.value = ''; document.forms['details'].photo.outerHTML = '<input name=photo type=file onChange=previewPhoto(this.value)>';"></td>
                </tr>
...

This used to work, and only certain details see to muck it up.

--BB
 
I found the answer was nothing to do with any of the above and was to do with the HTML editor I was using on a textarea.

If anyone else ever experiences this I hope they find this answer quicker than I did! (3+1/2 hours).

In the editor.js (can't remember who wrote this)

replace:
insertAdjacentHTML('AfterEnd'
with:
insertAdjacentHTML('BeforeBegin'

and all is well again!

--BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top