home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 2654
Discussions: 186,606, Posts: 2,227,043, Members: 230,240
Free Scan: Update Your PC's Outdated Drivers to Optimize Performance
Old July 7th, 2008, 03:56 AM   Digg it!   #1 (permalink)
Senior Member
 
Join Date: May 2003
Location: Aus, Gold Coast :)
Posts: 793
Send a message via ICQ to exally
Javascript Dynamic form/Tiny_mce edit

Hey guys i am trying to edit the tiny_mce image.htm file so i can allow it to upload files.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>{#advanced_dlg.image_title}</title>
	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
	<script type="text/javascript" src="../../utils/mctabs.js"></script>
	<script type="text/javascript" src="../../utils/form_utils.js"></script>
	<script type="text/javascript" src="js/image.js"></script>
	<script>
		function PstImage(frmid)
		{	
			myform = document.createElement('form');
			myform.action = "image.php";
			myform.method = "POST";
			myform.setAttribute("id","formID");
			myform.appendChild(frmid);
			
			myform.submit();
	   		 
		}
	</script>
	<base target="_self" />
</head>
<body id="image" style="display: none">
<form onsubmit="ImageDialog.update();return false;" action="#">
	<div class="tabs">
		<ul>
			<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.image_title}</a></span></li>
		</ul>
	</div>

	<div class="panel_wrapper">
		<div id="general_panel" class="panel current">
     <table border="0" cellpadding="4" cellspacing="0">
          <tr>
            <td nowrap="nowrap"><label for="file0">Image Local:</label></td>
            <td><table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><input id="file0" name="file0" type="file" class="mceFocus" value="" style="width: 200px"/><input type="button" value="Upload" onclick="PstImage(file0);"/></td>
                  <td id="srcbrowsercontainer">&nbsp;</td>
                </tr>
              </table></td>
          </tr>
		  <tr>
            <td nowrap="nowrap"><label for="src">{#advanced_dlg.image_src}</label></td>
            <td><table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><input id="src" name="src" type="text" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td>
                  <td id="srcbrowsercontainer">&nbsp;</td>
                </tr>
              </table></td>
          </tr>
		  <tr>
			<td><label for="image_list">{#advanced_dlg.image_list}</label></td>
			<td><select id="image_list" name="image_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;"></select></td>
		  </tr>
          <tr>
            <td nowrap="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td>
            <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>
          </tr>
          <tr>
            <td nowrap="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td>
            <td><select id="align" name="align" onchange="ImageDialog.updateStyle();">
                <option value="">{#not_set}</option>
                <option value="baseline">{#advanced_dlg.image_align_baseline}</option>
                <option value="top">{#advanced_dlg.image_align_top}</option>
                <option value="middle">{#advanced_dlg.image_align_middle}</option>
                <option value="bottom">{#advanced_dlg.image_align_bottom}</option>
                <option value="text-top">{#advanced_dlg.image_align_texttop}</option>
                <option value="text-bottom">{#advanced_dlg.image_align_textbottom}</option>
                <option value="left">{#advanced_dlg.image_align_left}</option>
                <option value="right">{#advanced_dlg.image_align_right}</option>
              </select></td>
          </tr>
          <tr>
            <td nowrap="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td>
            <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />
              x
              <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>
          </tr>
          <tr>
            <td nowrap="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td>
            <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
          </tr>
          <tr>
            <td nowrap="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td>
            <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
          </tr>
          <tr>
            <td nowrap="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td>
            <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
          </tr>
        </table>
		</div>
	</div>

	<div class="mceActionPanel">
		<div style="float: left">
			<input type="submit" id="insert" name="insert" value="{#insert}" />
		</div>

		<div style="float: right">
			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
		</div>
	</div>
</form>
<script>
	var loc = document.location.href;
	if(loc.search('location=') > -1)
	{
		document.getElementById('src').value = loc.substr(loc.search('location=')+9);
	}
</script>
</body>
</html>
specifically looking at
Code:
<script>
		function PstImage(frmid)
		{	
			myform = document.createElement('form');
			myform.action = "image.php";
			myform.method = "POST";
			myform.setAttribute("id","formID");
			myform.appendChild(frmid);
			
			myform.submit();
	   		 
		}
	</script>
	<base target="_self" />
</head>
<body id="image" style="display: none">
<form onsubmit="ImageDialog.update();return false;" action="#">
	<div class="tabs">
		<ul>
			<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.image_title}</a></span></li>
		</ul>
	</div>

	<div class="panel_wrapper">
		<div id="general_panel" class="panel current">
     <table border="0" cellpadding="4" cellspacing="0">
          <tr>
            <td nowrap="nowrap"><label for="file0">Image Local:</label></td>
            <td><table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><input id="file0" name="file0" type="file" class="mceFocus" value="" style="width: 200px"/><input type="button" value="Upload" onclick="PstImage(file0);"/></td>
                  <td id="srcbrowsercontainer">&nbsp;</td>
                </tr>
              </table></td>
          </tr>
i am getting no javascript errors and have used that javascript before to post a form.. Though i don't create the form in the function and 'steal' a object from another form. Any ideas why this wouldn't be posting to image.php? it doens't redirect or anything, i just lose the file object from the screen and nothing happens

exally is offline   Reply With Quote
TechIMO.com Ads - Login or register for less ads.
How many errors does your computer have?

You no longer need to guess! This free stability scan and registry cleaner download will give you a complete diagnosis of your Windows registry, identifying errors and conflicts.

FREE instant scan


Guest, Register Free! to remove this ad and get your tech support questions answered in minutes!
Old July 7th, 2008, 08:40 PM     #2 (permalink)
Senior Member
 
Join Date: May 2003
Location: Aus, Gold Coast :)
Posts: 793
Send a message via ICQ to exally
ok i have fixed the prob, changed the code quite a bit but the main two problems were

document.appendChild(myform); needed to be added to the function and
enctype="multipart/form-data" had to be affixed to the form. so i guess it would have been myform.enctype in the end. i am not sure as in the end i did it a totally different way

exally is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
web form selection javascript help elfranger Webmastering and Programming 5 May 21st, 2004 10:50 AM
javascript form MitaDC Webmastering and Programming 0 March 6th, 2004 02:57 AM
Dynamic Disk hathor Applications and Operating Systems 3 January 25th, 2004 12:54 PM
Trying to keep a dynamic ip yml87 Networking and Internet 3 January 18th, 2004 12:02 AM
JavaScript: Form Validation... Agent_Embryo Webmastering and Programming 10 April 16th, 2002 04:58 PM

Most Active Discussions
Is It Just Me? (526)
Misery Loves Company... (1849)
Why Does the MOON Grow Bigger as It.. (18)
heatsink issue (10)
New Mobo (18)
UPGRADING C/D DRIVE TO 250GB & .. (14)
SSD's, RAID, and External Backup (7)
1 internet. 1 house. 3 computer. ho.. (13)
Is This A Compatible Gaming PC? (18)
Recent Discussions
C++ compiler suggestions (4)
Official World of Warcraft Thre.. (4529)
Programming question (2)
UPGRADING C/D DRIVE TO 250GB &a.. (14)
Ubuntu or Xubuntu....anyone!!? (7)
Building my first PC and need s.. (0)
PNY vs Gainward (3)
Linksys WRT54G (2)
Contest: Logo and Banner design.. (0)
FS: Dell 6000 laptop, modded 36.. (2)
Apple iPod touch 16 GB $200 (4)
Six 28-Disc Cross Design Black .. (4)


All times are GMT -4. The time now is 11:45 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28