<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1031684" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1031684</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/dynamic-form-names-javascript#comment-1186256</link>
    <description> &lt;p&gt;Thanks for the responses! Let me explain a little more what I&#039;m trying to do. I have a form that lets users click on a formatting button to insert formatted text into a textarea. It works very much like the &quot;Guided mode&quot; of this forum software. Click on the &quot;B&quot; and you get a pop-up that accepts text. When the user is done, [b] tags get placed around what they typed. &lt;/p&gt;
&lt;p&gt;It works perfectly fine right now. However, I wanted to add a form on another page, and reuse the javascript code that I&#039;ve already created. That is why I was trying to capture the form name. I didn&#039;t know how to do that, which is why I was using:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;if(document.content_form)&lt;br /&gt;&amp;nbsp; form_name = &amp;#039;content_form&amp;#039;;&lt;br /&gt;else if(document.event_form)&lt;br /&gt;&amp;nbsp; form_name = &amp;#039;event_form&amp;#039;;&lt;/code&gt;&lt;/div&gt;&#039;&lt;br /&gt;
I know this isn&#039;t the best method, as it would be better if I didn&#039;t have to add lines of code every time I wanted to reused the JavaScript. Maybe someone can suggest how to do that. &lt;/p&gt;
&lt;p&gt;Now, once I have the form name, I need to insert the form name in my next line of code:&lt;br /&gt;
&lt;code&gt;document.content_form.content.value += &amp;quot;&amp;lt;p&amp;gt;&amp;quot; + formatted_text + &amp;quot;&amp;lt;/p&amp;gt;&amp;quot;;&lt;/code&gt;&#039;&lt;br /&gt;
Here, &quot;content_form&quot; should be whatever form name was captured in the previous step. This line of code places  [p] tags around the entered text and inserts it into the textarea. &lt;/p&gt;
&lt;p&gt;I hope that clarifies things. This should be very easy to do.&lt;/p&gt;
 </description>
     <pubDate>Tue, 22 Nov 2005 21:10:36 +0000</pubDate>
 <dc:creator>jumpyg</dc:creator>
 <guid isPermaLink="false">comment 1186256 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/dynamic-form-names-javascript#comment-1185718</link>
    <description> &lt;p&gt;&lt;em&gt;if(document.content_form)&lt;/em&gt; and &lt;em&gt;if(document.event_form&lt;/em&gt; only check for the presence of those two forms, not whether one or the other is the active form. That is, unless this snippet is in a function that we can&#039;t see.&lt;/p&gt;
&lt;p&gt;You&#039;ll have to show us a lot more code, or better yet, a test page, so we can see your exact setup and what you&#039;re trying to do. Also, what do you mean when you say it doesn&#039;t work? What error do you get, if any? How does the script behave?&lt;/p&gt;
&lt;p&gt;There&#039;s a few other changes you&#039;ll probably need to make too, such as using the appropriate &lt;em&gt;getElementById()&lt;/em&gt; selector rather than directly accessing the form from &lt;em&gt;document&lt;/em&gt;. More on that later.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Wed, 16 Nov 2005 06:50:00 +0000</pubDate>
 <dc:creator>Abhishek Reddy</dc:creator>
 <guid isPermaLink="false">comment 1185718 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/dynamic-form-names-javascript#comment-1185717</link>
    <description> &lt;p&gt;Ouch! that script is quite far from useing web standerds... Have you tried viewing it in Firefox? You&#039;ll find much more that that isnt working.&lt;/p&gt;
&lt;p&gt;So in order to put you back on the right track. I need to know a little more.&lt;br /&gt;
1) Are you just inserting text?&lt;br /&gt;
2) Why are you putting it in a form?&lt;/p&gt;
&lt;p&gt;lol, I just noticed you arnt useing brackets. Try this...&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;if(document.content_form){&lt;br /&gt;&amp;nbsp; form_name = &amp;#039;content_form&amp;#039;;&lt;br /&gt;}else if(document.event_form){&lt;br /&gt;&amp;nbsp; form_name = &amp;#039;event_form&amp;#039;;&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Wed, 16 Nov 2005 05:40:05 +0000</pubDate>
 <dc:creator>bja888</dc:creator>
 <guid isPermaLink="false">comment 1185717 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
