Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
AJAX insertion into DOM submit button "dead"
Old 09-10-2008, 08:05 PM AJAX insertion into DOM submit button "dead"
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
I am inserting a form into the DOM of a page via an AJAX call, the submit button is dead. The form works fine stand alone Do buttons have to be present on page load? Somebody please help, don't know how to pursue this!

Code:
 
 case "TextsForm":
   $SQL = "Select TemplateID From TempData";
   $result = mysql_query($SQL);
   $row = mysql_fetch_row($result);
   $ID = $row[0];
   $SQL = "Select * from Templates Where TemplateID = '$ID'";
   $result = mysql_query($SQL);
   $row=mysql_fetch_row($result);
    echo ("
<form id='formTexts' name='formTexts' method='get' action='Texts.php' target = '_blank'>
 <table align = 'center' class='style7' border='0'>
  <tr>
   <td>$row[1]  -  Text $i</td>
   <td><input type='Hidden' name='TemplateID' value = $ID/></td>
   <td><input type='Hidden' name='TxtID' value = $i/></td>
  </tr>
  <tr>
   <td>Left:</td>
   <td><input type='text' name='Left' /></td>
  </tr>
  <tr>
   <td>Bottom:</td>
   <td><input type='text' name='Bottom' /></td>
  </tr>
  <tr>
   <td>Width:</td>
   <td><input type='text' name='Width' /></td>
  </tr>
  <tr>
   <td>Height:</td>
   <td><input type='text' name='Height' /></td>
  </tr>
  <tr>
   <td>Font: </td>
   <td><input type='text' name='Font' /></td>
  </tr>
  <tr>
   <td>Color:</td>
   <td><input type='text' name='Color' /></td>
  </tr>
  <tr>
   <td>Shadow:</td>
   <td><input type='text' name='Shadow' /></td>
  </tr>
   <td>Text:</td>
   <td><input type='text' name='Shadow' value='Your Text' /></td>
  </tr>
  <tr>
  <td colspan='2'><div align='center'><input type='submit' value='Submit' /></div></td>
  </tr>
 </table>
</form>
   <tr>
    <td colspan='5' class='style8'><div align='center' class='style8'><a href = '#' title = 'Cancel Action' onClick = InitPage('Categories','Categories','','Templates','Initial','')>Cancel Action</a></div>
    </tr>
    ");
 break;
Code:
 
function InitPage(Element,Mode,ID,Element2,Mode2,ID2)
  {
     Init() Init() function creates xmlhttprequest object.
    xmlHttp.onreadystatechange=function()
        {
        if(xmlHttp.readyState==4)
          {
        document.getElementById(Element).innerHTML = xmlHttp.responseText;
        if (Element2)
         {
          InitPage(Element2,Mode2,ID2);
         }
          }
       }
      ReqStr = "InitPage.php?Element=" + Element + "&Mode=" + Mode +"&ID="+ID;
      xmlHttp.open("Get",ReqStr,true);
      xmlHttp.send(null);
     return;
 }

Last edited by Sleeping Troll; 09-10-2008 at 08:26 PM..
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-10-2008, 08:25 PM Re: AJAX insertion into DOM submit button "dead"
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
I tried changing button type to "reset", still nothing it is like button is not part of form...
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Old 09-10-2008, 11:25 PM Re: AJAX insertion into DOM submit button "dead"
thehuskybear's Avatar
Ultra Talker

Posts: 362
Name: Sam
Location: Tucson, AZ
Trades: 1
What browser are you testing with? IE has trouble handling the insertion of forms using ajax.. I think it throws a fatel error
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
thehuskybear is offline
Reply With Quote
View Public Profile Visit thehuskybear's homepage!
 
Old 09-11-2008, 09:03 AM Re: AJAX insertion into DOM submit button "dead"
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
IE, does not support insertion of table elements and some others, so I am forced to use FF, fortunately it is admin page and client does not mind.

Good thought though, I am thinking that form must be present in html of document not just in DOM.
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to AJAX insertion into DOM submit button "dead"
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19503 seconds with 12 queries