Delphi For PHP Forums       


Go Back   Delphi-PHP Forums > Programming > Javascript and Ajax
Forum Jump Register FAQ Members List Downloads Search Today's Posts Mark Forums Read

Javascript and Ajax Questions and information about working with Ajax and Javascript in Delphi for PHP.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 8th June 2009, 11:57
D4PHP Engineer
 
Join Date: Jul 2007
Posts: 431
classic is on a distinguished road
Default IE error not in FF

iWGSM contacts tab

The submit email button has the following code:

function Button1JSClick($sender, $params)
{
echo $this->Button1->ajaxCall("savecontact");
?>
//Add your javascript code here
alert('Your Email has been sent.');

return false;
<?php

}

function savecontact()
{
if ($this->ComboBox2->ItemIndex == '1' ) { $mr = 'Mr';}
if ($this->ComboBox2->ItemIndex == '2' ) { $mr = 'Mrs';}
if ($this->ComboBox2->ItemIndex == '3' ) { $mr = 'Miss';}
if ($this->ComboBox2->ItemIndex == '4' ) { $mr = 'Dr';}
if ($this->ComboBox2->ItemIndex == '5' ) { $mr = 'Other';}
$firstname = $this->JTAdvancedEdit2->Text;
$surname = $this->JTAdvancedEdit3->Text;
$email = $this->JTAdvancedEdit4->Text;
$tel = $this->JTAdvancedEdit5->Text;
$comments = $this->Memo1->Text;


$sql = "insert into contacts_from_web(`title`,`firstname`,`surname`,`e mail`,`contactno`,`notes`)". // indicate all fields here
"values ('".$mr."','".$firstname."','".$surname."','".$ema il."','".$tel."','".$comments."')";

$this->dbiwitness->execute($sql);
$this->JTAdvancedEdit2->Text = '';
$this->JTAdvancedEdit3->Text = '';
$this->JTAdvancedEdit4->Text = '';
$this->JTAdvancedEdit5->Text = '';
$this->Memo1->Text = '';


}

The record is inserted each time but in IE I get an error message but not in firefox.

Also how do I capture the error in IE as you can in FF.

Cheers

SteveW
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 8th June 2009, 14:43
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,271
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

The code is your response. It looks like the entire webpage. 21000 characters, the forum wouldn't let me show it all. Change your ajaxcall to just return your edits and see if that works. Even better would be to return ajaxresponse (and perhaps clearing the edits) that does the alert after the server has updated.

Code:
<?xml version="1.0" encoding="utf-8" ?><xjx><cmd n="as" t="Image7_outer" p="innerHTML"><![CDATA[<div id="Image7_container" style=" width: 129;  height: 83; overflow: hidden;text-align: center;" ><img id="Image7" src="Images/iwgsmlogo2.png"  width="129"  height="75"  border="0"  style="margin-top: 0;"     /></div>]]></cmd><cmd n="js"></cmd>< " value="" tabindex="0"></div>
<script language="JavaScript" type="text/javascript">
JTAdvEditInitialize( 'JTAdvancedEdit4', '', '_', '#', '', null );
</script>

</div>
<div id="JTAdvancedEdit5_outer" style="Z-INDEX: 8; LEFT: 247px; WIDTH: 200px; POSITION: absolute; TOP: 134px; HEIGHT: 24px">
<div id="JTAdvancedEdit5_outerdiv">
<input name="JTAdvancedEdit5" id="JTAdvancedEdit5" type="text" size="1" class="jtbb" style="cursor: ; float: left; width: 200px; background-color: #C0C0C0 " value="" tabindex="0"></div>
<script language="JavaScript" type="text/javascript">
JTAdvEditInitialize( 'JTAdvancedEdit5', '', '_', '#', '', null );
</script>

</div>
<div id="JTLabel3_outer" style="Z-INDEX: 9; LEFT: 162px; WIDTH: 49px; POSITION: absolute; TOP: 41px; HEIGHT: 18px">
<div id="JTLabel3_outerdiv">
<div id="JTLabel3" class="fsDefault" style="overflow: hidden; width:49px; height:18px; font-family: Arial, Helvetica, sans-serif; color: gray; text-align: left; font-style: normal; background: #FFFFFF;">Title</div></div>

</div>
<div id="JTLabel4_outer" style="Z-INDEX: 10; LEFT: 162px; WIDTH: 73px; POSITION: absolute; TOP: 67px; HEIGHT: 17px">
<div id="JTLabel4_outerdiv">
<div id="JTLabel4" class="fsDefault" style="overflow: hidden; width:73px; height:17px; font-family: Arial, Helvetica, sans-serif; color: gray; text-align: left; font-style: normal; background: #FFFFFF;">First Name</div></div>

</div>
<div id="JTLabel5_outer" style="Z-INDEX: 11; LEFT: 162px; WIDTH: 65px; POSITION: absolute; TOP: 89px; HEIGHT: 18px">
<div id="JTLabel5_outerdiv">
<div id="JTLabel5" class="fsDefault" style="overflow: hidden; width:65px; height:18px; font-family: Arial, Helvetica, sans-serif; color: gray; text-align: left; font-style: normal; background: #FFFFFF;">Surname</div></div>

</div>
<div id="JTLabel6_outer" style="Z-INDEX: 12; LEFT: 162px; WIDTH: 49px; POSITION: absolute; TOP: 113px; HEIGHT: 18px">
<div id="JTLabel6_outerdiv">
<div id="JTLabel6" class="fsDefault" style="overflow: hidden; width:49px; height:18px; font-family: Arial, Helvetica, sans-serif; color: gray; text-align: left; font-style: normal;">Email</div></div>

cmd><cmd n="as" t="Image9_outer" p="innerHTML"><![CDATA[<div id="Image9_container" style=" width: 119;  height: 39; overflow: hidden;" ><img id="Image9" src="Images/iWitnessCorporateLogoforDELPHI.png"  width="119"  height="39"  border="0"       /></div>]]></cmd><cmd n="js"></cmd><cmd n="js"><![CDATA[document.getElementById( 'JTIFrame1_outer' ).innerHTML = "<iframe id=\"JTIFrame1\" name=\"JTIFrame1\" style=\"width: 392px; height: 204px;\" src=\"html/UK/Copyright.vnu_website/index.html\" frameborder=\"0\" scrolling=\"auto\"></iframe>";

JTUpdateAnchors();
]]></cmd><cmd n="as" t="ComboBox1_outer" p="innerHTML"><![CDATA[<input type="hidden" name="ComboBox1_key[num]" value="1" /><select name="ComboBox1" id="ComboBox1" size="1" style=" font-family: Verdana; font-size: 10px;  background-color: #FFFFFF;height:16px;width:121px;"   tabindex="0"   ><option value="1" selected>UK</option></select>]]></cmd><cmd n="js"></cmd></xjx>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 9th June 2009, 18:35
D4PHP Engineer
 
Join Date: Jul 2007
Posts: 431
classic is on a distinguished road
Default errors

That did the trick thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11th June 2009, 14:02
D4PHP User
 
Join Date: Jun 2009
Posts: 15
UptownWings is on a distinguished road
Default

I seem to have the same issue here and I'm at a total loss on how to fix it.

what I basically do is do an ajax call, and I process data on the form. based on the result, i make some changes to the color and contents of a panel.
Can't get anymore basic than that imho.

In Firefox I don't have a problem and everything works as planned, but in IE for some odd reason, i'm getting a rather nasty XML error thrown at me.
The XML error kind of shows me that what is returned is the entire site as XML content.

Weird though that Firefox has no problems with this.

Can anyone point out to me how I can fix this ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 11th June 2009, 23:56
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,271
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

echo $this->Button1->ajaxCall("Button1Click",array(), array('Button1','Button2','Panel1'));
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 12th June 2009, 04:51
D4PHP User
 
Join Date: Jun 2009
Posts: 15
UptownWings is on a distinguished road
Default

Huh ? I must have overlooked that approximately a thousand times then.

Anyways, I'll check this out and see how it goes...


edit : Yep, that did the trick. Thanks a bunch
So what basically happens here is that I provide an array with names of controls to xajax and that xajax will limit it's response to those controls ? Or at least that is what it looks like in debug mode.
I'm a bit ashamed that I didn't see this any sooner. Oh well, again, thanks, that was a lifesaver.

Last edited by UptownWings; 12th June 2009 at 05:28. Reason: Tried solution
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 12th June 2009, 05:38
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,271
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

Yep, that about covers it. (it is also faster )
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 27th June 2009, 21:05
esr esr is offline
just Joined!
 
Join Date: Oct 2008
Posts: 3
esr is on a distinguished road
Default Otra forma de llamar ajax

function Button3JSClick($sender, $params)
{

?>
xajax_ajaxProcess('Asiento','Button1',params,'Limp iarForm',xajax.getFormValues('Asiento'),[]);
return false;

<?php

}
Asiento="Nombre de la Forma", en este caso se llama 'Asiento'.
LimpiarForm= funcion definida por el usuario.
[]= Colocar los objetos que se enviarán con el ajax, ejemplo['Edit1','Edit2']
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


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

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 On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 11:44.




Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 ©2009, Crawlability, Inc.
Copyright © 2004 - 2009, G&J Solutions Ltd. All Rights Reserved. terms of use