[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Error copying code to an HTML element

Posted on 2012-04-04
8
Medium Priority
?
289 Views
Last Modified: 2012-04-09
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 !!!
0
Comment
Question by:amucinobluedot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 18

Expert Comment

by:nap0leon
ID: 37806616
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.
0
 

Author Comment

by:amucinobluedot
ID: 37806793
Like i said, this is the error:

Undefined
ReferenceError:can't find variable: dmxedit_insertHTML

I have no idea why i get this ?
0
 
LVL 18

Accepted Solution

by:
nap0leon earned 2000 total points
ID: 37806978
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

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:amucinobluedot
ID: 37807588
I tried the code above and unfortunately nothing happens .. no error but doesnt copy the tags either.  :(
0
 

Author Comment

by:amucinobluedot
ID: 37807601
formcode.txtHere is the whole form code, in case I  may be missing something else.
0
 
LVL 18

Expert Comment

by:nap0leon
ID: 37808381
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.
0
 

Author Comment

by:amucinobluedot
ID: 37808438
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 ...
0
 
LVL 18

Expert Comment

by:nap0leon
ID: 37808505
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
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question