11 Replies Latest reply on Sep 16, 2008 6:07 PM by moabyte

    how can I keep Dreamweaver from re-writing my code?

    moabyte
      How can you stabilize your code so Dreamweaver leaves it as you wrote it? I get it right, then dreamweaver rewrites it wrong. I fix it, then dreamweaver 'fixes' it and it's wrong again. I've done this over and over and can't get the code I wrote to stick.
        • 1. Re: how can I keep Dreamweaver from re-writing my code?
          Level 7
          What do you mean by "rewrite"? Are you referring to format?

          --
          Murray --- ICQ 71997575
          Adobe Community Expert
          (If you *MUST* email me, don't LAUGH when you do so!)
          ==================
          http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
          http://www.dwfaq.com - DW FAQs, Tutorials & Resources
          ==================


          "moabyte" <webforumsuser@macromedia.com> wrote in message
          news:gae6uc$4gl$1@forums.macromedia.com...
          > How can you stabilize your code so Dreamweaver leaves it as you wrote it?
          > I get
          > it right, then dreamweaver rewrites it wrong. I fix it, then dreamweaver
          > 'fixes' it and it's wrong again. I've done this over and over and can't
          > get the
          > code I wrote to stick.
          >

          • 2. Re: how can I keep Dreamweaver from re-writing my code?
            Level 7
            Can you give us an example of Before and After code?

            --
            Regards

            John Waller
            • 3. Re: how can I keep Dreamweaver from re-writing my code?
              Level 7
              example of exactly what a string of code looks like when you type it:

              example of exactly what dreamweaver rewrites it to on saving the file, or
              what it looks like after closing then reopening the file.

              and- do you have all code rewriting turned of in dw preferences->code
              rewriting

              --
              Alan
              Adobe Community Expert, dreamweaver

              http://www.adobe.com/communities/experts/



              • 4. Re: how can I keep Dreamweaver from re-writing my code?
                moabyte Level 1
                Thank you all for replying! I can't keep Dreamweaver from putting in small changes that make a cgi form quit working. It works in the 'before' stage, below, but doesn't work either after sending to remote server, or maybe it's after closing Dreamweaver and reopening. It has happened numerous times and for a while I thought I was crazy, but finally I realized Dreamweaver is doing this. When I reopen the document, it has changes as 'after' below.

                Under 'code rewriting' in Preferences, the "never rewrite code' option is grayed out. Is that the spot where you turn it off or is it somewhere else?

                You can view the 'finished' page, but with cgi form that doesn't work (because I can't get Dreamweaver to leave it alone) here: http://www.slickrock.com/adventureisland.html

                Many Many thanks.



                Before:

                <table border="0" width="212" class="datestable">
                <tr>
                <th colspan="2" scope="col"><div align="center">Get Belize Travel Specials</div></th>
                </tr>
                <tr class="alternate">
                <td colspan="2"><p align="center" class="datestablebold">$50-off coupon in every
                newsletter! We notify you as soon as we put a trip on sale</p></td>
                </tr>
                <tr class="alternate">
                <td><p>E-Mail Address</p></td>
                <td><!--text to make a form work-->
                <form name="formmail" action="/cgi-bin/formmail/formmail.cgi" method="post" >
                <input type=hidden name="recipient" value="slickrock@slickrock.com" >
                <input type=hidden name= "subject" value="Specials Sign-up from the Adventure Island page" >
                <!--end of top of form-->
                <p>
                <input type="text" name="email" value="E-Mail Address" onfocus="this.value=''" size="16" >
                </p>
                </td>

                </tr>

                <tr class="alternate">
                <td><p>First/Last Name</p></td>
                <td><input type="text" name="Name" value="First and Last Name" onfocus="this.value=''" size="16"> </td>
                </tr>

                <tr class="alternate">
                <td></td>
                <td><input type="submit" name="Submit" value="Sign up!">
                <!--text end of form-->
                <input type="hidden" name="redirect" value=" http://www.slickrock.com/thankyouspecial.htm"></form>
                <!--text end of form end--> </td>
                </tr>
                </table>


                After:
                <table border="0" width="212" class="datestable">
                <tr>
                <th colspan="2" scope="col"><div align="center">Get Belize Travel Specials</div></th>
                </tr>
                <tr class="alternate">
                <td colspan="2"><p align="center" class="datestablebold">$50-off coupon in every
                newsletter! We notify you as soon as we put a trip on sale</p></td>
                </tr>
                <tr class="alternate">
                <td><p>E-Mail Address</p></td>
                <td><!--text to make a form work-->
                <form name="formmail" action="/cgi-bin/formmail/formmail.cgi" method="post" >
                <input type=hidden name="recipient" value="slickrock@slickrock.com" />
                <input type=hidden name= "subject" value="Specials Sign-up from the Adventure Island page" />
                <!--end of top of form-->
                <p>
                <input type="text" name="email" value="E-Mail Address" onfocus="this.value=''" size="16" />
                </p>
                </form></td>
                </tr>
                <tr class="alternate">
                <td><p>First/Last Name</p></td>
                <td><input type="text" name="Name" value="First and Last Name" onfocus="this.value=''" size="16" /> </td>
                </tr>
                <tr class="alternate">
                <td></td>
                <td><input type="submit" name="Submit" value="Sign up!" />
                <!--text end of form-->
                <input type="hidden" name="redirect" value=" http://www.slickrock.com/thankyouspecial.htm" />
                <!--text end of form end--> </td>
                </tr>
                </table>
                • 5. Re: how can I keep Dreamweaver from re-writing my code?
                  Level 7
                  I think your original code is invalid. You start a form inside a table cell
                  (<td>) but your form closing tag (</form>) is outside that table cell. I
                  don't believe that is allowed. DW is merely moving the misplaced (</form>.

                  --

                  Walt


                  "moabyte" <webforumsuser@macromedia.com> wrote in message
                  news:gaej83$hom$1@forums.macromedia.com...
                  > Thank you all for replying! I can't keep Dreamweaver from putting in small
                  > changes that make a cgi form quit working. It works in the 'before' stage,
                  > below, but doesn't work either after sending to remote server, or maybe
                  > it's
                  > after closing Dreamweaver and reopening. It has happened numerous times
                  > and for
                  > a while I thought I was crazy, but finally I realized Dreamweaver is doing
                  > this. When I reopen the document, it has changes as 'after' below.
                  >
                  > Under 'code rewriting' in Preferences, the "never rewrite code' option is
                  > grayed out. Is that the spot where you turn it off or is it somewhere
                  > else?
                  >
                  > You can view the 'finished' page, but with cgi form that doesn't work
                  > (because
                  > I can't get Dreamweaver to leave it alone) here:
                  > http://www.slickrock.com/adventureisland.html
                  >
                  > Many Many thanks.
                  >
                  >
                  >
                  > Before:
                  >
                  > <table border="0" width="212" class="datestable">
                  > <tr>
                  > <th colspan="2" scope="col"><div align="center">Get Belize
                  > Travel
                  > Specials</div></th>
                  > </tr>
                  > <tr class="alternate">
                  > <td colspan="2"><p align="center" class="datestablebold">$50-off
                  > coupon in every
                  > newsletter! We notify you as soon as we put a trip on
                  > sale</p></td>
                  > </tr>
                  > <tr class="alternate">
                  > <td><p>E-Mail Address</p></td>
                  > <td><!--text to make a form work-->
                  > <form name="formmail" action="/cgi-bin/formmail/formmail.cgi"
                  > method="post" >
                  > <input type=hidden name="recipient"
                  > value="slickrock@slickrock.com" >
                  > <input type=hidden name= "subject" value="Specials Sign-up from
                  > the
                  > Adventure Island page" >
                  > <!--end of top of form-->
                  > <p>
                  > <input type="text" name="email" value="E-Mail Address"
                  > onfocus="this.value=''" size="16" >
                  > </p>
                  > </td>
                  >
                  > </tr>
                  >
                  > <tr class="alternate">
                  > <td><p>First/Last Name</p></td>
                  > <td><input type="text" name="Name" value="First and Last Name"
                  > onfocus="this.value=''" size="16"> </td>
                  > </tr>
                  >
                  > <tr class="alternate">
                  > <td></td>
                  > <td><input type="submit" name="Submit" value="Sign up!">
                  > <!--text end of form-->
                  > <input type="hidden" name="redirect"
                  > value=" http://www.slickrock.com/thankyouspecial.htm"></form>
                  > <!--text end of form end--> </td>
                  > </tr>
                  > </table>
                  >
                  >
                  > After:
                  > <table border="0" width="212" class="datestable">
                  > <tr>
                  > <th colspan="2" scope="col"><div align="center">Get Belize Travel
                  > Specials</div></th>
                  > </tr>
                  > <tr class="alternate">
                  > <td colspan="2"><p align="center" class="datestablebold">$50-off
                  > coupon
                  > in every
                  > newsletter! We notify you as soon as we put a trip on
                  > sale</p></td>
                  > </tr>
                  > <tr class="alternate">
                  > <td><p>E-Mail Address</p></td>
                  > <td><!--text to make a form work-->
                  > <form name="formmail" action="/cgi-bin/formmail/formmail.cgi"
                  > method="post" >
                  > <input type=hidden name="recipient"
                  > value="slickrock@slickrock.com" />
                  > <input type=hidden name= "subject" value="Specials Sign-up
                  > from
                  > the Adventure Island page" />
                  > <!--end of top of form-->
                  > <p>
                  > <input type="text" name="email" value="E-Mail Address"
                  > onfocus="this.value=''" size="16" />
                  > </p>
                  > </form></td>
                  > </tr>
                  > <tr class="alternate">
                  > <td><p>First/Last Name</p></td>
                  > <td><input type="text" name="Name" value="First and Last Name"
                  > onfocus="this.value=''" size="16" /> </td>
                  > </tr>
                  > <tr class="alternate">
                  > <td></td>
                  > <td><input type="submit" name="Submit" value="Sign up!" />
                  > <!--text end of form-->
                  > <input type="hidden" name="redirect"
                  > value=" http://www.slickrock.com/thankyouspecial.htm" />
                  > <!--text end of form end--> </td>
                  > </tr>
                  > </table>
                  >


                  • 6. Re: how can I keep Dreamweaver from re-writing my code?
                    Level 7
                    That would sure be the ticket.

                    --
                    Murray --- ICQ 71997575
                    Adobe Community Expert
                    (If you *MUST* email me, don't LAUGH when you do so!)
                    ==================
                    http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                    http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                    ==================


                    "Walt F. Schaefer" <walt@waltswebworx.com> wrote in message
                    news:gaejub$ie3$1@forums.macromedia.com...
                    >I think your original code is invalid. You start a form inside a table cell
                    >(<td>) but your form closing tag (</form>) is outside that table cell. I
                    >don't believe that is allowed. DW is merely moving the misplaced (</form>.
                    >
                    > --
                    >
                    > Walt
                    >
                    >
                    > "moabyte" <webforumsuser@macromedia.com> wrote in message
                    > news:gaej83$hom$1@forums.macromedia.com...
                    >> Thank you all for replying! I can't keep Dreamweaver from putting in
                    >> small
                    >> changes that make a cgi form quit working. It works in the 'before'
                    >> stage,
                    >> below, but doesn't work either after sending to remote server, or maybe
                    >> it's
                    >> after closing Dreamweaver and reopening. It has happened numerous times
                    >> and for
                    >> a while I thought I was crazy, but finally I realized Dreamweaver is
                    >> doing
                    >> this. When I reopen the document, it has changes as 'after' below.
                    >>
                    >> Under 'code rewriting' in Preferences, the "never rewrite code' option is
                    >> grayed out. Is that the spot where you turn it off or is it somewhere
                    >> else?
                    >>
                    >> You can view the 'finished' page, but with cgi form that doesn't work
                    >> (because
                    >> I can't get Dreamweaver to leave it alone) here:
                    >> http://www.slickrock.com/adventureisland.html
                    >>
                    >> Many Many thanks.
                    >>
                    >>
                    >>
                    >> Before:
                    >>
                    >> <table border="0" width="212" class="datestable">
                    >> <tr>
                    >> <th colspan="2" scope="col"><div align="center">Get Belize
                    >> Travel
                    >> Specials</div></th>
                    >> </tr>
                    >> <tr class="alternate">
                    >> <td colspan="2"><p align="center"
                    >> class="datestablebold">$50-off
                    >> coupon in every
                    >> newsletter! We notify you as soon as we put a trip on
                    >> sale</p></td>
                    >> </tr>
                    >> <tr class="alternate">
                    >> <td><p>E-Mail Address</p></td>
                    >> <td><!--text to make a form work-->
                    >> <form name="formmail" action="/cgi-bin/formmail/formmail.cgi"
                    >> method="post" >
                    >> <input type=hidden name="recipient"
                    >> value="slickrock@slickrock.com" >
                    >> <input type=hidden name= "subject" value="Specials Sign-up from
                    >> the
                    >> Adventure Island page" >
                    >> <!--end of top of form-->
                    >> <p>
                    >> <input type="text" name="email" value="E-Mail Address"
                    >> onfocus="this.value=''" size="16" >
                    >> </p>
                    >> </td>
                    >>
                    >> </tr>
                    >>
                    >> <tr class="alternate">
                    >> <td><p>First/Last Name</p></td>
                    >> <td><input type="text" name="Name" value="First and Last Name"
                    >> onfocus="this.value=''" size="16"> </td>
                    >> </tr>
                    >>
                    >> <tr class="alternate">
                    >> <td></td>
                    >> <td><input type="submit" name="Submit" value="Sign up!">
                    >> <!--text end of form-->
                    >> <input type="hidden" name="redirect"
                    >> value=" http://www.slickrock.com/thankyouspecial.htm"></form>
                    >> <!--text end of form end--> </td>
                    >> </tr>
                    >> </table>
                    >>
                    >>
                    >> After:
                    >> <table border="0" width="212" class="datestable">
                    >> <tr>
                    >> <th colspan="2" scope="col"><div align="center">Get Belize Travel
                    >> Specials</div></th>
                    >> </tr>
                    >> <tr class="alternate">
                    >> <td colspan="2"><p align="center" class="datestablebold">$50-off
                    >> coupon
                    >> in every
                    >> newsletter! We notify you as soon as we put a trip on
                    >> sale</p></td>
                    >> </tr>
                    >> <tr class="alternate">
                    >> <td><p>E-Mail Address</p></td>
                    >> <td><!--text to make a form work-->
                    >> <form name="formmail" action="/cgi-bin/formmail/formmail.cgi"
                    >> method="post" >
                    >> <input type=hidden name="recipient"
                    >> value="slickrock@slickrock.com" />
                    >> <input type=hidden name= "subject" value="Specials Sign-up
                    >> from
                    >> the Adventure Island page" />
                    >> <!--end of top of form-->
                    >> <p>
                    >> <input type="text" name="email" value="E-Mail Address"
                    >> onfocus="this.value=''" size="16" />
                    >> </p>
                    >> </form></td>
                    >> </tr>
                    >> <tr class="alternate">
                    >> <td><p>First/Last Name</p></td>
                    >> <td><input type="text" name="Name" value="First and Last Name"
                    >> onfocus="this.value=''" size="16" /> </td>
                    >> </tr>
                    >> <tr class="alternate">
                    >> <td></td>
                    >> <td><input type="submit" name="Submit" value="Sign up!" />
                    >> <!--text end of form-->
                    >> <input type="hidden" name="redirect"
                    >> value=" http://www.slickrock.com/thankyouspecial.htm" />
                    >> <!--text end of form end--> </td>
                    >> </tr>
                    >> </table>
                    >>
                    >
                    >

                    • 7. Re: how can I keep Dreamweaver from re-writing my code?
                      Level 7
                      Could be although DW can even be instructed not to fix that via Preferences

                      Edit > Preferences

                      Category: Code Rewriting
                      Rewrite code: UNcheck "Fix invalidly nested and unclosed tags"

                      or you can check this option and ask DW to warn you when it's about to fix
                      something.

                      --
                      Regards

                      John Waller

                      • 8. Re: how can I keep Dreamweaver from re-writing my code?
                        moabyte Level 1
                        Walt, Murray and John,

                        Thanks very much for your answers but this isn't fixing it. I tried moving the </form> tag to after value="Sign up!"> but that didn't work, trying to get it closer to the end of the working form part of the code, but Dreamweaver moved it back. The </form> tag after the redirect tag works (where it is in the 'before' version); it is on another part of my website, I'm just redesigning it, but used to use Front Page which didn't change my code, but I have just switched to DW. Also, did you notice it is putting in 6 new "/" that are not in the original:

                        ...value="slickrock@slickrock.com" />
                        ...Adventure Island page" />
                        ...size="16" />
                        ...size="16" />
                        ...value="Sign up!" />
                        ...value=" http://www.slickrock.com/thankyouspecial.htm" />

                        None of those / are in the original, DW is putting them in.


                        If you go to this page: http://www.slickrock.com/adv.htm you can see the same form, working, with the </form> tag where I am trying to put it.

                        Walt, you mentioned putting it in the same table cell, but I need the other cells to make it line up like I want. are you saying I should use div tags instead and get rid of the table?

                        Also, John, the "Fix invalidly nested and unclosed tags" is already unchecked.

                        I have spent hours on this and can't figure it out and REALLY REALLY appreciate all of your help.

                        Lucy Wallingford


                        • 9. Re: how can I keep Dreamweaver from re-writing my code?
                          Level 7
                          > None of those / are in the original, DW is putting them in.

                          That's because you told it to by allowing your page to be created with an
                          XHTML doctype. WHat you cite as DW's annoying addition, is actually DW
                          rigorously adhering to the requirements of the XHTML doctype. And, it's
                          perfectly valid XHTML.

                          As for your page that you link below, until you can produce pages that
                          validate -

                          http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.slickrock.com%2Fadv.htm

                          - you will never be able to avoid DW's attempt to make a silk purse out of
                          your sow's ear, to coin a phrase. DW *will* try to correct your syntax
                          errors unless you specifically tell it not to in your PREFERENCES.

                          --
                          Murray --- ICQ 71997575
                          Adobe Community Expert
                          (If you *MUST* email me, don't LAUGH when you do so!)
                          ==================
                          http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                          http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                          ==================


                          "moabyte" <webforumsuser@macromedia.com> wrote in message
                          news:gamn16$j2o$1@forums.macromedia.com...
                          > Walt, Murray and John,
                          >
                          > Thanks very much for your answers but this isn't fixing it. I tried moving
                          > the
                          > </form> tag to after value="Sign up!"> but that didn't work, trying to get
                          > it
                          > closer to the end of the working form part of the code, but Dreamweaver
                          > moved
                          > it back. The </form> tag after the redirect tag works (where it is in the
                          > 'before' version); it is on another part of my website, I'm just
                          > redesigning
                          > it, but used to use Front Page which didn't change my code, but I have
                          > just
                          > switched to DW. Also, did you notice it is putting in 6 new "/" that are
                          > not in
                          > the original:
                          >
                          > ...value="slickrock@slickrock.com" />
                          > ...Adventure Island page" />
                          > ...size="16" />
                          > ...size="16" />
                          > ...value="Sign up!" />
                          > ...value=" http://www.slickrock.com/thankyouspecial.htm" />
                          >
                          > None of those / are in the original, DW is putting them in.
                          >
                          >
                          > If you go to this page: http://www.slickrock.com/adv.htm you can see the
                          > same
                          > form, working, with the </form> tag where I am trying to put it.
                          >
                          > Walt, you mentioned putting it in the same table cell, but I need the
                          > other
                          > cells to make it line up like I want. are you saying I should use div tags
                          > instead and get rid of the table?
                          >
                          > Also, John, the "Fix invalidly nested and unclosed tags" is already
                          > unchecked.
                          >
                          > I have spent hours on this and can't figure it out and REALLY REALLY
                          > appreciate all of your help.
                          >
                          > Lucy Wallingford
                          >
                          >
                          >
                          >

                          • 10. Re: how can I keep Dreamweaver from re-writing my code?
                            Level 7
                            You're welcome.

                            >I need the other
                            > cells to make it line up like I want. are you saying I should use div tags
                            > instead and get rid of the table?

                            No, you can use the table but if you start the form (<form>) inside a cell
                            you have to close it there. Another option might be to put the table inside
                            the form tags instead of vice-versa. Sorry to say but what's stumping you is
                            that you haven't taken the time to actually understand how HTML works. DW is
                            doing nothing wrong just trying to protect you from yourself. If it lets you
                            write mangled code you will regret it sometime when your site breaks.

                            --

                            Walt


                            "moabyte" <webforumsuser@macromedia.com> wrote in message
                            news:gamn16$j2o$1@forums.macromedia.com...
                            > Walt, Murray and John,
                            >
                            > Thanks very much for your answers but this isn't fixing it. I tried moving
                            > the
                            > </form> tag to after value="Sign up!"> but that didn't work, trying to get
                            > it
                            > closer to the end of the working form part of the code, but Dreamweaver
                            > moved
                            > it back. The </form> tag after the redirect tag works (where it is in the
                            > 'before' version); it is on another part of my website, I'm just
                            > redesigning
                            > it, but used to use Front Page which didn't change my code, but I have
                            > just
                            > switched to DW. Also, did you notice it is putting in 6 new "/" that are
                            > not in
                            > the original:
                            >
                            > ...value="slickrock@slickrock.com" />
                            > ...Adventure Island page" />
                            > ...size="16" />
                            > ...size="16" />
                            > ...value="Sign up!" />
                            > ...value=" http://www.slickrock.com/thankyouspecial.htm" />
                            >
                            > None of those / are in the original, DW is putting them in.
                            >
                            >
                            > If you go to this page: http://www.slickrock.com/adv.htm you can see the
                            > same
                            > form, working, with the </form> tag where I am trying to put it.
                            >
                            > Walt, you mentioned putting it in the same table cell, but I need the
                            > other
                            > cells to make it line up like I want. are you saying I should use div tags
                            > instead and get rid of the table?
                            >
                            > Also, John, the "Fix invalidly nested and unclosed tags" is already
                            > unchecked.
                            >
                            > I have spent hours on this and can't figure it out and REALLY REALLY
                            > appreciate all of your help.
                            >
                            > Lucy Wallingford
                            >
                            >
                            >
                            >


                            • 11. Re: how can I keep Dreamweaver from re-writing my code?
                              moabyte Level 1
                              Walt,

                              THANK YOU THANK YOU. I just tried your idea. I moved the <form> and </form> outside of the table and it FIXED IT. Dreamweaver also stopped putting in the mysterious (to me) slashes. You really have no idea how fantastic this is for me. I'm writing code in a vacuum here, I have no one to ask and no courses offered in this small town. I'm teaching myself DW with "The Missing Manual". Thanks SO much.

                              Lucy Wallingford