We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44963
    • 16 Posts
    I am trying to include the following form, generated through my email provider, on a ModX page:

    <table>
    <script language='javascript' src='http://bh.inboxgroup.com/phase2/bhecho_files/smartlists/check_entry.js'></script>
    <script language="javascript">
    	<!--
    		function check_cdfs(form) {
    			return true;
    		}
    	-->
    </script><style type="text/css">
            body{
                background-color:#EEEEEE;
            }
    </style><form action="https://bh.inboxgroup.com/phase2/bullseye/contactupdate1.php3" method="post" 
    name="bullseye" id="bullseye">
    
     
    <tr>
    <td> <input type=hidden name="cid" value="d23173ea23223662f42513a014c9fe92">
    <div align="right"><font face="Arial, Helvetica, sans-serif" style = 'font-size:14px;color:#000000'><b>Email:</b></font></div>
    </td>
    <td>
    <input type="text" name="email">
    </td>
    </tr>         
      
    <tr>
    <td colspan="2">
    <center>
    <input type="submit" name="SubmitBullsEye" value="Submit">
     <input type=hidden name='grp[]' value='1178500'> 
    <input type='hidden' name='redirect_url' value='http://www.wordrakelaw.com/thanks'> 
    <input type='hidden' name='fontface' value='Arial, Helvetica, sans-serif'> 
    <input type='hidden' name='fontsize' value='14px'> 
    <input type='hidden' name='background_color' value='#EEEEEE'> 
    <input type='hidden' name='textColor' value='#000000'>
    </center>
    </td>
    </tr>
    </form>
    </table>


    When I put it on the page and save, ModX strips out the <form> coding and the Javascript. What can I do to get this to work?
      • 3749
      • 24,544 Posts
      MODX itself doesn't strip any HTML or JS code from a page.

      Your JS is calling a function that seems not to exist and most of the fields of the Form are hidden and have no labels. When you do a "View Source" on the page, what do you see?

      BTW, I think you want this in the JS if you don't want to call that function, rather than HTML comment tags:

      /*
              function check_cdfs(form) {
                  return true;
              }
      */
      



        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 44963
        • 16 Posts
        Never mind -- I found the problem. If I put the <form> tags outside the <table> it works better. Thank you for the feedback!
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Technically CSS isn't supposed to be in the page body.

          You can use a very simple snippet instead, with $modx->regClientCSS(...) and $modx->regClientStartupScript(...), which will load your CSS (style block or link to .css file) and your javascript in the head. $modx->regClientScript(...) will load javascript at the end of the page, just before the closing body tag.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 20371
            • 58 Posts
            Quote from: sottwell at Jun 03, 2014, 11:50 PM
            Technically CSS isn't supposed to be in the page body.

            You can use a very simple snippet instead, with $modx->regClientCSS(...) and $modx->regClientStartupScript(...), which will load your CSS (style block or link to .css file) and your javascript in the head. $modx->regClientScript(...) will load javascript at the end of the page, just before the closing body tag.

            I used to create snippets to do exactly this.. turns out they're included in the distribution and can be used as output filters now, ala [[$scriptElementChunk:htmlToHead]] [[$jsUrl:jsToBottom]] et cetera.