Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

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 !!!
Avatar of nap0leon
nap0leon

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.
Avatar of Aleks

ASKER

Like i said, this is the error:

Undefined
ReferenceError:can't find variable: dmxedit_insertHTML

I have no idea why i get this ?
ASKER CERTIFIED SOLUTION
Avatar of nap0leon
nap0leon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

I tried the code above and unfortunately nothing happens .. no error but doesnt copy the tags either.  :(
Avatar of Aleks

ASKER

formcode.txtHere is the whole form code, in case I  may be missing something else.
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.
Avatar of Aleks

ASKER

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 ...
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