Error copying code to an HTML element

I have a form with a drop down menu and an HTML element. (From DMX Zone).
ASP Classic / VBScript

The code below is for the drop down menu, when a selection is made its supposed to insert the tags into the text editor wherever the cursor is at that time.

---

<select name="s" size="1" class="bodytext" onchange="dmxedit_insertHTML('editor1',document.form1.s.options[document.form1.s.selectedIndex].value)">
                    <option value=" "></option>
                    <option value="[Alien:Title] [Alien:First] [Alien:Last]<br>[Alien:ResStr]<br>[Alien:ResCity], [Alien:ResState] [Alien:ResZip]">Contact - Block</option>
                    <option value="[Alien:Last]">Contact - Last Name</option>
                    <option value="[Alien:First]">Contact - First Name</option>
                    <option value="[Alien:MidName]">Contact - Middle Name</option>
                    <option value="[Alien:Title]">Contact - Title</option>
                    <option value="[Alien:MaidenNm]">Contact - Maiden Name</option>
                    <option value="[Alien:MailCareof]">Contact - Mail Address Care Of</option>
                    <option value="[Alien:MailStr]">Contact - Mail Address Street</option>
                    <option value="[Alien:MailApt]">Contact - Mail Address Apt.</option>
                    <option value="[Alien:MailCity]">Contact - Mail Address City</option>
                    <option value="[Alien:MailState]">Contact - Mail Address State</option>
                    <option value="[Alien:MailZip]">Contact - Mail Address Zip Code</option>
                    <option value="[Alien:MailCntry]">Contact - Mail Address Country</option>
                    <option value="[Alien:ResCareOf]">Contact - Residence Address Care Of</option>
                    <option value="[Alien:ResStr]">Contact - Residence Address Street</option>
                    <option value="[Alien:ResApt]">Contact - Residence Address Apt.</option>
                    <option value="[Alien:ResCity]">Contact - Residence Address City</option>
                    <option value="[Alien:ResState]">Contact - Residence Address State</option>
                    <option value="[Alien:ResZip]">Contact - Residence Address Zip Code</option>
                    <option value="[Alien:ResCntry]">Contact - Residence Address Country</option>
                    <option value="[Alien:AbrdCareOf]">Contact - Abroad Address Care Of</option>
                    <option value="[Alien:AbrdStr]">Contact - Abroad Address Street</option>
                    <option value="[Alien:AbrdApt]">Contact - Abroad Address Apt.</option>
                    <option value="[Alien:AbrdCity]">Contact - Abroad Address City</option>
                    <option value="[Alien:AbrdState]">Contact - Abroad Address State</option>
                    <option value="[Alien:AbrdZip]">Contact - Abroad Address Zip Code</option>
                    <option value="[Alien:AbrdCntry]">Contact - Abroad Address Country</option>
                    <option value="[Alien:Dob]">Contact - Date of birth</option>
                    <option value="[Alien:Country]">Contact - Country of birth</option>
                    <option value="[Alien:PPNum]">Contact - Passport Number</option>
                    <option value="[Alien:PPCountry]">Contact - Passport Country</option>
                    <option value="[Alien:PPExpiration]">Contact - Passport exp. Date</option>
                    <option value="[Alien:Nationality]">Contact - Nationality</option>
                    <option value="[Alien:AlienNum]">Contact - Alien Number</option>
                    <option value="[Alien:SSN]">Contact - SSN</option>
                    <option value="[Alien:Dayphone]">Contact - Dayphone</option>
                    <option value="[Alien:EvePhone]">Contact - Evening Phone</option>
                    <option value="[Alien:Fax]">Contact - Fax</option>
                    <option value="[Alien:Email]">Contact - Email</option>
                    <option value="[Alien:Arrivaldate]">Contact - Arrival date</option>
                    <option value="[Alien:Arrivalcity]">Contact - Arrival city</option>
                    <option value="[Alien:Arrivalstate]">Contact - Arrival state</option>
                    <option value="[Alien:I94]">Contact - I94 number</option>
                    <option value="[Alien:NiStatus]">Contact - Current status</option>
                    <option value="[Alien:ExpiresOn]">Contact - Status exp. Date</option>
                    <option value="[Case:CaseId]">Case - Number</option>
                    <option value="[Case:CaseName]">Case - Name</option>
                    <option value="[LawFirm:Name]">Law Firm - Name</option>
                    <option value="[Employer:AttnTo]<br>[Employer:EmpName]<br> [Employer:Street], [Employer:Suite]<br>[Employer:City], [Employer:State] [Employer:Zip]">Employer - Block</option>
                    <option value="[Employer:EmpName]">Employer - Name</option>
                    <option value="[Employer:Street]">Employer - Street</option>
                    <option value="[Employer:Suite]">Employer - Suite</option>
                    <option value="[Employer:City]">Employer - City</option>
                    <option value="[Employer:State]">Employer - State</option>
                    <option value="[Employer:Zip]">Employer - Zip code</option>
                    <option value="[Employer:Country]">Employer - Country</option>
                    <option value="[Employer:AttnTo]">Employer - Attn to</option>
                    <option value="[Employer:Phone]">Employer - Phone</option>
                    <option value="[Employer:Fax]">Employer - Fax</option>
                    <option value="[Employer:email]">Employer - Email</option>
                    <option value="[Employer:SignLastNm]">Employer - Last Name of person authorized to sign</option>
                    <option value="[Employer:SignFirstNm]">Employer - First Name of person authorized to sign</option>
                    <option value="[Employer:SignTitle]">Employer - Tile Last of person authorized to sign</option>
                    <option value="[Employer:IRS]">Employer - IRS Tax #</option>
                    <option value="[Employer:SSN]">Employer - SSN</option>
                    <option value="[Employer:BusinessType]">Employer - Business Type</option>
                    <option value="[Employer:I94]">Employer - Year established</option>
                    <option value="[Employer:Employees]">Employer - Number of Employees</option>
                    <option value="[Employer:GrossIncome]">Employer - Gross Income</option>
                    <option value="[Employer:NetIncome]">Employer - Net Income</option>
                  </select>

-----

This is the code for the HTML element

<textarea id="editor1" name="editor1" class="dmxEditor" style="width:600px;height:300px"><%=(LetterMrg.Fields.Item("LtrBody").Value)%></textarea>
                  <script type="text/javascript">
  // <![CDATA[
 jQuery(document).ready(
   function()
     {
       jQuery("#editor1").dmxEditor(
         {}
       );
     }
 );
  // ]]>
                  </script>

------

If I use any computer or browser nothing happens when the selection is made, BUT if i use an ipad the following error is displayed:

Undefined
ReferenceError:can't find variable: dmxedit_insertHTML

Hope thats a hint for what I may be missing ... help is GREATLY appreciated !!!
LVL 1
AleksAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nap0leonCommented:
If I use any computer or browser nothing happens when the selection is made, BUT if i use an ipad the following error is displayed:

Have you checked the error console in your browsers?
In FireFox it is at "Tools"-->"Web Developer"-->"Error Console" (or [Ctrl]+[Shift]+[J])

Based on the error message you are seeing on the iPad, that function is not loaded... you should double-check your reference to the script that contains the dmxeditor.
AleksAuthor Commented:
Like i said, this is the error:

Undefined
ReferenceError:can't find variable: dmxedit_insertHTML

I have no idea why i get this ?
nap0leonCommented:
Like i said, this is the error:

Undefined
ReferenceError:can't find variable: dmxedit_insertHTML

The browser does not know what "dmxedit_HTML" is.
Like I said, check the reference to your dmx editor.  

Create a webpage with nothing but your drop-down, select an entry from the drop-down, and notice you receive that error.
<form name="form1">
<select name="s" size="1" class="bodytext" onchange="dmxedit_insertHTML('editor1',document.form1.s.options[document.form1.s.selectedIndex].value)">
	<option value=" "></option>
	<option value="[Alien:Title] [Alien:First] [Alien:Last]<br>[Alien:ResStr]<br>[Alien:ResCity], [Alien:ResState] [Alien:ResZip]">Contact - Block</option>
	<option value="[Alien:Last]">Contact - Last Name</option>
	<option value="[Alien:First]">Contact - First Name</option>
</select>
</form>

Open in new window


Now add a script block that contains a function named dmxedit_insertHTML, select an item from your drop-down, notice you do not receive the error:
<script>
function dmxedit_insertHTML(one,two){return true}
</script>
<form name="form1">
<select name="s" size="1" class="bodytext" onchange="dmxedit_insertHTML('editor1',document.form1.s.options[document.form1.s.selectedIndex].value)">
	<option value=" "></option>
	<option value="[Alien:Title] [Alien:First] [Alien:Last]<br>[Alien:ResStr]<br>[Alien:ResCity], [Alien:ResState] [Alien:ResZip]">Contact - Block</option>
	<option value="[Alien:Last]">Contact - Last Name</option>
	<option value="[Alien:First]">Contact - First Name</option>
</select>
</form>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

AleksAuthor Commented:
I tried the code above and unfortunately nothing happens .. no error but doesnt copy the tags either.  :(
AleksAuthor Commented:
formcode.txtHere is the whole form code, in case I  may be missing something else.
nap0leonCommented:
I tried the code above and unfortunately nothing happens .. no error but doesnt copy the tags either.  :(

There is an error in the first one, you just aren't seeing it.  Follow the instructions in my first post that tell you how to locate the "Error Console" in FireFox. (Similar are available in the other browsers as well).

The code did not copy to anywhere because a) the code that does the copy does not exist in the page (which causes the error you are trying to locate) and b) the webpage posted above does not have any section labeled with 'editor' so even if the function did exist, it would not be able to copy it there because "there" does not exist.
AleksAuthor Commented:
I installed Firefox and there are no errors displayed in the console when i select from the drop down menu. Quite simply nothing is copied over.

The code of the form is attached above. You will see the naming is right, the element is there ...
nap0leonCommented:
If you didn't get an error, then you cannot possibly be running the code I posted above or you have something set that has disabled javascript, etc.
Try the attached.  After you are able to verify the error, remove the comment lines (the \\) from the function declaration at the top, refresh the page, and see that the error goes away.

In FireFox, you will see the following error:
Timestamp: 4/4/2012 5:06:31 PM
Error: dmxedit_insertHTML is not defined
Source File: file:///C:/test/test.html
Line: 1

Open in new window

test.html
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.