Hi everyone
i have a very straight forward question
i am using few server side validations (suggested in the forums) , i have created a php file (validation.php) and copied this code into it as well and would like to use it as ajax request, these serverside validation in validation tab are working 100% fine but user has to submit to see the error. i want to give user instant feedback while he is typing in the username and password fields.
like
also i have used this code to include javascript file in the page (as suggested in forum), i have pasted this in my form, and this does include the file in the page
here is the actual javascript code mootools1.2 ajax fucntions (as suggested in the forum) in validation.js
and here is my form code
i have another question this ajax function works when you click a link in a div but i want this function to work when user type in the textfield and clicks in the second textfield like the CF's current validation.
i have tested this ajax method outside of joomla in simple html file and it works
but here inside CF its not working. i might be missing some thing, can some one point out.
if this live ajax request can work then this approach can be useful to many people using CF
Regards
Salman Sadiq
i have a very straight forward question
i am using few server side validations (suggested in the forums) , i have created a php file (validation.php) and copied this code into it as well and would like to use it as ajax request, these serverside validation in validation tab are working 100% fine but user has to submit to see the error. i want to give user instant feedback while he is typing in the username and password fields.
like
<?php
/*check if user exist*/
$db =& JFactory::getDBO();
$text =& JRequest::getString('text_3', '', 'post');
$sql = "
SELECT COUNT(*)
FROM jos_users
WHERE username = ".$db->quote($text).";";
if ( $debug ) echo "sql: ".print_r($sql, true)."<br /><br />";
$db->setQuery( $sql );
if ( $database->loadResult() != 0 ) {
return "Username Already Taken";
}
?>
<?php
/*check if both password match*/
global $mainframe;
if ( JRequest::getVar('text_5') != JRequest::getVar('text_6') )
return 'Sorry, your passwords do not match, please try again!';
?>
<?php
/*check if both password field is not empty*/
global $mainframe;
if(JRequest::getVar('text_5') !== ''))
return 'Password cannot be empty';
?>
also i have used this code to include javascript file in the page (as suggested in forum), i have pasted this in my form, and this does include the file in the page
<?php
$document =& JFactory::getDocument();
$document->addScript(JURI::Base().'templates/radiology/js/validation.js');
?>
here is the actual javascript code mootools1.2 ajax fucntions (as suggested in the forum) in validation.js
window.addEvent('domready', function() {
// ajax replace element text
$('text_3').addEvent('click', function(event) {
//prevent the page from changing
event.stop();
//url from where to fetch the data
var url="validation.php";
//make the ajax call, replace text
var req = new Request.HTML({
method: 'get',
url: url,
//data: { 'do' : '1' },
update: $('username_msg'),
onComplete: function(response) { $('username_msg').setStyle('background','#fffea1'); }
}).send();
});
//addEvent('click', function(event) { alert('Request made. Please wait...'); })
});
and here is my form code
<div class="form_item" >
<div class="form_element cf_textbox">
<a href="#" id="ajax-replace">Click here</a>
<label class="cf_label">User Name*</label>
<input name="text_3" type="text" id="text_3" size="30" maxlength="150" class="cf_inputbox required">
<a class="tooltiplink" onclick="return false;"><img class="tooltipimg" src="components/com_chronocontact/css/images/tooltip.png" border="0" width="16" height="16"></a>
<div class="tooltipdiv" >User Name* :: Chose your user name. Your will use this to login to the Radiology fourms and website</div>
</div>
<div id="username_msg" ></div>
<div class="clear"> </div>
</div>
i have another question this ajax function works when you click a link in a div but i want this function to work when user type in the textfield and clicks in the second textfield like the CF's current validation.
i have tested this ajax method outside of joomla in simple html file and it works
but here inside CF its not working. i might be missing some thing, can some one point out.
if this live ajax request can work then this approach can be useful to many people using CF
Regards
Salman Sadiq
Hi guys solved some of the issues.
i figured out that joomla 1.5.8 is using mootools1.1 instead of mootools 1.2.1 so i used wrong ajax function, after changing the ajax funtion to this i got ajax to work, also i should have used id="ajax-replace" where are is was using "text_3"
so here is the correct mootools 1.1 ajax fucntion
now i can receive the output of validation.php
and the contents of validation.php are
the file validation.php is on the root of the joomla, but when i replace the contents of validation.php with this
it throws this error
i have tried to search but not able to find a definitive answer, that why is this happening.
i figured out that joomla 1.5.8 is using mootools1.1 instead of mootools 1.2.1 so i used wrong ajax function, after changing the ajax funtion to this i got ajax to work, also i should have used id="ajax-replace" where are is was using "text_3"
so here is the correct mootools 1.1 ajax fucntion
window.addEvent('domready', function() {
$('ajax-replace').addEvent('click', function(e) {
e = new Event(e).stop();
var url = "/radiology/validation.php";
//var url = "index.php?option=com_jumi&fileid=37";
new Ajax(url, {
method: 'get',
update: $('username_msg')
}).request();
});
});
now i can receive the output of validation.php
and the contents of validation.php are
<?php echo ('Nice thing!'); ?>
the file validation.php is on the root of the joomla, but when i replace the contents of validation.php with this
//check if user exist
/* $db =& JFactory::getDBO();
$text =& JRequest::getString('text_3', '', 'post');
//$text='salman';
$sql = "
SELECT COUNT(*)
FROM jos_users
WHERE username = ".$db->quote($text).";";
if ( $debug ) echo "sql: ".print_r($sql, true)."<br /><br />";
$db->setQuery( $sql );
if ( $database->loadResult() != 0 ) {
return "Username Already Taken";
} */
it throws this error
Fatal error: Class 'JFactory' not found in C:\wamp\www\radiology\validation.php on line 3
i have tried to search but not able to find a definitive answer, that why is this happening.
Hi salman,
The problem here is that validation.php is just a stand-alone php file and isn't loading any of the Joomla Framework so you can only use raw PHP.
I've done something similar by creating a chronoform say 'ajax_form', putting the code from your validation.php into the form html, turning off all the 'extras' like emails and validation; then using index2.php?option=com_chronocontact&chronoformname=ajax_form to call it.
Bob
The problem here is that validation.php is just a stand-alone php file and isn't loading any of the Joomla Framework so you can only use raw PHP.
I've done something similar by creating a chronoform say 'ajax_form', putting the code from your validation.php into the form html, turning off all the 'extras' like emails and validation; then using index2.php?option=com_chronocontact&chronoformname=ajax_form to call it.
Bob
Hi Bob!
thanks bob for reading through my lengthy post and suggesting the solution.
almost there, just a little issue.
i have done following as suggested by you
1) created a new form named it ajax_form
2) then i enabled it
3) opened the form in edit mode and clicked on "Form Code" tab and then clicked on "Form HTML" and pasted the validation.php code in here with tags
4) in my validation.js i changed the url to "index2.php?option=com_chronocontact&chronoformname=ajax_form"
after these steps its giving me this response "Joomla Professional Work" and nothing else. i have tried echoing and that does work, but it does not check the username from database.
so at the moment every thing related to ajax response is working just need to get the php code right so that when user fills in the username field a request is sent to php code and that sends back the message is username is available of not.
regards
salman
thanks bob for reading through my lengthy post and suggesting the solution.
almost there, just a little issue.
i have done following as suggested by you
1) created a new form named it ajax_form
2) then i enabled it
3) opened the form in edit mode and clicked on "Form Code" tab and then clicked on "Form HTML" and pasted the validation.php code in here with tags
<?php
//check if user exist
global $db;
$db =& JFactory::getDBO();
$text =& JRequest::getString('text_3', '', 'post');
$sql = "
SELECT COUNT(*)
FROM jos_users
WHERE username = ".$db->quote($text).";";
if ( $debug ) echo "sql: ".print_r($sql, true)."<br /><br />";
$db->setQuery( $sql );
if ( $database->loadResult() != 0 ) {
return "Username Already Taken";
}
?>
4) in my validation.js i changed the url to "index2.php?option=com_chronocontact&chronoformname=ajax_form"
after these steps its giving me this response "Joomla Professional Work" and nothing else. i have tried echoing and that does work, but it does not check the username from database.
so at the moment every thing related to ajax response is working just need to get the php code right so that when user fills in the username field a request is sent to php code and that sends back the message is username is available of not.
regards
salman
Hi salman,
I don't know much about AJAX - Max posted a working example a few weeks back that might be worth looking at.
Are you passing a variable back in the $_POST array OK? Does it work OK if you add the variable to the calling URL and check $_GET?
Bob
I don't know much about AJAX - Max posted a working example a few weeks back that might be worth looking at.
Are you passing a variable back in the $_POST array OK? Does it work OK if you add the variable to the calling URL and check $_GET?
Bob
Hi bob!
thanks again
can you point out that post by max please.
i tried to echo the text variable but it does not print any thing.
i think this code only executes when we submit the form, where as i am trying to get this code to work on the form before submiting. so i think value in the text field is not passed to this code in php and thats why its not able to executes.
can you tell how can i get the value from the text field when user goes to the next field (same type of effect in CF native validation like if one field is required and if i dont fill it and move to next one it shows the message under the field), i want that when user goes to next field after filling in the username field, i am able to extract the value from the username field who's id is text_3 and send a request to php code to check if that value alread exist in the db.
so can you tell me how to get value out of a text field and how to add that value to this URL
regards
salman
thanks again
can you point out that post by max please.
i tried to echo the text variable but it does not print any thing.
global $db;
$db =& JFactory::getDBO();
$text =& JRequest::getString('text_3', '', 'post');
echo "$text"';
i think this code only executes when we submit the form, where as i am trying to get this code to work on the form before submiting. so i think value in the text field is not passed to this code in php and thats why its not able to executes.
can you tell how can i get the value from the text field when user goes to the next field (same type of effect in CF native validation like if one field is required and if i dont fill it and move to next one it shows the message under the field), i want that when user goes to next field after filling in the username field, i am able to extract the value from the username field who's id is text_3 and send a request to php code to check if that value alread exist in the db.
so can you tell me how to get value out of a text field and how to add that value to this URL
index2.php?option=com_chronocontact&chronoformname=ajax_form
regards
salman
Hi Salman,
lets do this step by step to make sure everything is working correctly, in the AJAX form HTML code box write :
now do your AJAX call (I didn't read the whole topic) and tell me what do you get the in the response! Firebug will give you some idea about the real AJAX response too if you missed something in the final output code!
Cheers
Max
lets do this step by step to make sure everything is working correctly, in the AJAX form HTML code box write :
this is AJAX output
now do your AJAX call (I didn't read the whole topic) and tell me what do you get the in the response! Firebug will give you some idea about the real AJAX response too if you missed something in the final output code!
Cheers
Max
Hi max!
thanks for the reply.
as suggested in the ajaxform i pasted "this is ajax output" and called this form "ajax_form" with this url "index2.php?option=com_chronocontact&chronoformname=ajax_form" and it output "this is AJAX output
Joomla Professional Work " so this means that ajax request to this form is working.
then i pasted the php validation code into the ajax_from and that didnt ouputed anything, this is the php code
to this moment ajax call is going perfectly without any problem but there was no ouput to tell if the username is available or not.
then i looked closely and found out that value of the text field (username text field id='text_3') was not being forwarded to the the php code. so i searched in the forum and found out a method to send values with url so changes the initial url
"index2.php?option=com_chronocontact&chronoformname=ajax_form"
TO
"index2.php?option=com_chronocontact&chronoformname=ajax_form&value=(value from the text field)"
i have used this code "username=$('text_3').value;" to get the from the text field but when i use this variable "username" in the url it doesnot replace it self with the value it has in it. so just to see if this scheme works i hard coded the value in the url to a username which is already registered in the db to check if i get the error "Username Already Taken"
and again it did not gave any response then i looked the php code and changed
$text =& JRequest::getString('value', '', 'post');
TO
$text =& JRequest:: getString('value');
and then refreshed the page and to my surprise i got the message i was looking for
"Username Already Taken"
i hope you are on the same page with me
so i have two questions
1) how to add value from "text_3" text field to the url dynamicly.
2) how to trigger ajax request automatically instead of clicking on a link (just like CF validation).
3) also i want more then one validations through ajax_form like both password fields match and they are not empty but dont knwo how to do this and dont know how to pass variable and all that stuff confused.
this is the javascript that i am using for ajax
thankyou for your support and help looking forward to the answer
Regards
salman
thanks for the reply.
as suggested in the ajaxform i pasted "this is ajax output" and called this form "ajax_form" with this url "index2.php?option=com_chronocontact&chronoformname=ajax_form" and it output "this is AJAX output
Joomla Professional Work " so this means that ajax request to this form is working.
then i pasted the php validation code into the ajax_from and that didnt ouputed anything, this is the php code
<?php
//check if user exist
global $db;
$db =& JFactory::getDBO();
//$text =& JRequest::getString('value', '', 'get');
$text =& JRequest:: getString('value');
$sql = "
SELECT COUNT(*)
FROM jos_users
WHERE username = ".$db->quote($text).";";
if ( $debug ) echo "sql: ".print_r($sql, true)."<br /><br />";
$db->setQuery( $sql );
if ( $database->loadResult() != 0 )
{echo "Username Already Taken";}
else
{echo "This Username is available";}
?>
to this moment ajax call is going perfectly without any problem but there was no ouput to tell if the username is available or not.
then i looked closely and found out that value of the text field (username text field id='text_3') was not being forwarded to the the php code. so i searched in the forum and found out a method to send values with url so changes the initial url
"index2.php?option=com_chronocontact&chronoformname=ajax_form"
TO
"index2.php?option=com_chronocontact&chronoformname=ajax_form&value=(value from the text field)"
i have used this code "username=$('text_3').value;" to get the from the text field but when i use this variable "username" in the url it doesnot replace it self with the value it has in it. so just to see if this scheme works i hard coded the value in the url to a username which is already registered in the db to check if i get the error "Username Already Taken"
and again it did not gave any response then i looked the php code and changed
$text =& JRequest::getString('value', '', 'post');
TO
$text =& JRequest:: getString('value');
and then refreshed the page and to my surprise i got the message i was looking for
"Username Already Taken"
i hope you are on the same page with me
so i have two questions
1) how to add value from "text_3" text field to the url dynamicly.
2) how to trigger ajax request automatically instead of clicking on a link (just like CF validation).
3) also i want more then one validations through ajax_form like both password fields match and they are not empty but dont knwo how to do this and dont know how to pass variable and all that stuff confused.
this is the javascript that i am using for ajax
window.addEvent('domready', function() {
$('ajax-replace').addEvent('click', function(e) {
e = new Event(e).stop();
var username=$('text_3').value;
var url = "index2.php?option=com_chronocontact&chronoformname=ajax_form&value=admin";
new Ajax(url, {
method: 'get',
update: $('username_msg')
}).request();
});
});
thankyou for your support and help looking forward to the answer
Regards
salman
Hi Salman,
you may need to change the logic your code works to get it working, you can submit the whole form using the AJAX and use document.getElementById JS function to get the text_3 field value and use the AJAX onFinished request function to check the result and submit the form or display the error, #3 is already answered here before at the forums!
Regards
Max
you may need to change the logic your code works to get it working, you can submit the whole form using the AJAX and use document.getElementById JS function to get the text_3 field value and use the AJAX onFinished request function to check the result and submit the form or display the error, #3 is already answered here before at the forums!
Regards
Max
Hi Max!
thankyou for answering again.
ok i have done it , checking username from the db using ajax is done.
here is the image

in the above image you can see my ajax responses in both cases when username is available and when not available.
the only issue here is i have to click "Check User Name" link every time i want to check the username.
1) i want that when user fills in the username field tabs to the next one this same functions is called to do this automatically (same as what happens in CF validation).
2) this validation is working perfetly in Firefox and google chrome but not in IE, infect it is requesting the url and php is sending the response back but IE is not writing this response in the div.
3) i also want my registered user to login and update the form fields which they filled in on the time of registration . There are about 20 fields and half of them are not required which user may fill afterwords. i dont want to give ordinary members access to db, so is there a way to do this. i want form updating feature on the frontend not backend.
regards
salman sadiq
thankyou for answering again.
ok i have done it , checking username from the db using ajax is done.
here is the image

in the above image you can see my ajax responses in both cases when username is available and when not available.
the only issue here is i have to click "Check User Name" link every time i want to check the username.
1) i want that when user fills in the username field tabs to the next one this same functions is called to do this automatically (same as what happens in CF validation).
2) this validation is working perfetly in Firefox and google chrome but not in IE, infect it is requesting the url and php is sending the response back but IE is not writing this response in the div.
3) i also want my registered user to login and update the form fields which they filled in on the time of registration . There are about 20 fields and half of them are not required which user may fill afterwords. i dont want to give ordinary members access to db, so is there a way to do this. i want form updating feature on the frontend not backend.
regards
salman sadiq
Hi max
1) just found solution to on click issue
i replaced
TO
and started to work perfectly.
2) now the second question of ajax response not being embed into the page in IE, i have searched to best of my knowledge and not able to find the answer, need help.
3) registered user can update their form from front end, please help me with this as well.
4) i have copied three code snippets a) username checker b) both password field checker if they are same c) if username field is not empty, in the dummy validation form's html code (ajax_form). but here is a serious issue that can send username as a value in url but i cant send password fields in the url, it will compromize the security, also when any of these code snippets enouter error they echo some text and that is displayed in all three divs , username_ajaxmsg, and password_ajax div
so how to stop this, can more then one dummy validation forms can be used to achieve this or is there another better solution.
1) just found solution to on click issue
i replaced
$('text_3').addEvent('click', function(e) {
TO
$('text_3').addEvent('blur', function(e) {
and started to work perfectly.
2) now the second question of ajax response not being embed into the page in IE, i have searched to best of my knowledge and not able to find the answer, need help.
3) registered user can update their form from front end, please help me with this as well.
4) i have copied three code snippets a) username checker b) both password field checker if they are same c) if username field is not empty, in the dummy validation form's html code (ajax_form). but here is a serious issue that can send username as a value in url but i cant send password fields in the url, it will compromize the security, also when any of these code snippets enouter error they echo some text and that is displayed in all three divs , username_ajaxmsg, and password_ajax div
so how to stop this, can more then one dummy validation forms can be used to achieve this or is there another better solution.
Hi Salman,
Glad you made some progress!๐
#2- no reason for IE to not display the AJAX result, it should work well, check your code again!
#3- use another form and connect to the same table and load the user id, how many tables the data is stored in ? are you aware of using SQL ?
#4- I can't understand!
Regards
Max
Glad you made some progress!๐
#2- no reason for IE to not display the AJAX result, it should work well, check your code again!
#3- use another form and connect to the same table and load the user id, how many tables the data is stored in ? are you aware of using SQL ?
#4- I can't understand!
Regards
Max
Hi Max
#2 infect there is a huge problem, IE doesnot allow to include <form></form> tags within <form></form>tags and thats why the response is not written back to the div.
read this (its not mootools or php but principle is same)
http://www.ibm.com/developerworks/forums/thread.jspa?threadID=223955&tstart=0
when i javascript calls the dummy validation form (ajax_form) it sends this response
firefox ignores the form within form error but ie doesnot and to varify this i copied the response to another file and removed form tags and i got the response straightaway, so form tags are the issue in this case
possible solution (according to๐)
1) remove the <form></form> tags from the ajax response before sending it to the browser
2) we should not use dummy form method to run php code as it send some unnecessary code and <from></form> tags as well.
max what do you say about it. i hope i am clear on this issue
i am working on #3 will come back if got any problem on that, and data will come from table "jos_chronoforms_paidmember" but data from name, email and password fields should also go to "jos_users" table as well.
4# i just want multiple validations on more then one fields , like i want to check if username field is not empty and then i want to check that it exist or not (which i have already done), also i want to check that both password fields are same.
but there is a problem with writing all the php logic in one file dummy form (ajax_form) because if in the code there are three if statements and they all get false and echo some messages then that combined response is going to every div in the page i have set for catching that reponse. see this image

instead of responses going into their respective divs they go in each div
regards
salman
#2 infect there is a huge problem, IE doesnot allow to include <form></form> tags within <form></form>tags and thats why the response is not written back to the div.
read this (its not mootools or php but principle is same)
http://www.ibm.com/developerworks/forums/thread.jspa?threadID=223955&tstart=0
when i javascript calls the dummy validation form (ajax_form) it sends this response
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtm
l1-transitional
.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, follow" />
<meta name="keywords" content="joomla, Joomla" />
<meta name="description" content="Joomla! - the dynamic portal engine and content management syste
m"
/>
<meta name="generator" content="Joomla! 1.5 - Open Source Content Management" />
<title>Radiology</title>
<link href="/radiology/templates/rhuk_milkyway/favicon.ico" rel="shortcut icon" type="image/x-icon
"
/>
<link rel="stylesheet" href="/radiology/templates/rhuk_milkyway/css/template.css" type="text/css" /
>
</head>
<body class="contentpane">
<form name="ChronoContact_ajax_form" id="ChronoContact_ajax_form" method="post" action="ht
tp
://localhost/radiology/index.php?option=com_chronocontact&task=send&chronoformname=ajax_form
"
>
<div id="answer" style="color:green" >This Username is Available</div> <input type="hidden" nam
e
="fa9bdfee0fc20ddc3d2f23ab80dac36d" value="1" />
</form>
<!-- You are not allowed to remove or edit the following 3 lines anyway if you didnt buy a license
-->
<div class="chronoform">
<a href="http://www.chronoengine.com">Joomla Professional Work</a>
</div>
<!-- You are not allowed to remove or edit the above 3 lines anyway if you didnt buy a license -->
</body>
</html>
firefox ignores the form within form error but ie doesnot and to varify this i copied the response to another file and removed form tags and i got the response straightaway, so form tags are the issue in this case
possible solution (according to๐)
1) remove the <form></form> tags from the ajax response before sending it to the browser
2) we should not use dummy form method to run php code as it send some unnecessary code and <from></form> tags as well.
max what do you say about it. i hope i am clear on this issue
i am working on #3 will come back if got any problem on that, and data will come from table "jos_chronoforms_paidmember" but data from name, email and password fields should also go to "jos_users" table as well.
4# i just want multiple validations on more then one fields , like i want to check if username field is not empty and then i want to check that it exist or not (which i have already done), also i want to check that both password fields are same.
but there is a problem with writing all the php logic in one file dummy form (ajax_form) because if in the code there are three if statements and they all get false and echo some messages then that combined response is going to every div in the page i have set for catching that reponse. see this image

instead of responses going into their respective divs they go in each div
regards
salman
Hi Salman,
#2- sorry but why do you use extra form tags ? the form does have form tags already and your AJAX will work!
#3- OK!
#4- what about many AJAX calls ? no problem with this! OR may be 3 results split ? you can play with the AJAX response the way you like!
Regards,
Max
#2- sorry but why do you use extra form tags ? the form does have form tags already and your AJAX will work!
#3- OK!
#4- what about many AJAX calls ? no problem with this! OR may be 3 results split ? you can play with the AJAX response the way you like!
Regards,
Max
Hi Max!
#2- i havent added any form tags, even if i add "hello world" in the ajax_form--->form code---->form html. and simple string like "hello world" is sent like this <form>hello world</form>. i think this is the default behaviour of the CF.
following is the response when i added "hello world" in ajax_form
how can i disable from tags in the form, or stop them from being posted
so what do you suggest, and i think ajax_form sends some really unnecessary code in response, where as it should only send "hello world".
#3- i have created a new form connected to that same table (jos_chronoforms_paidmember) but no input fields are showing up to update the that table, i also want to update another table's 3 fields from this table.
#4- yes you are rite on this i am working on this
also not related to the topic but login session is very small on this site, it takes me long time to type an reply (have to translate english to my language and then my language to english) and when i am done writing the reply and try to submit it it says to login again, i think you should increase login session time.
regards
salman
#2- i havent added any form tags, even if i add "hello world" in the ajax_form--->form code---->form html. and simple string like "hello world" is sent like this <form>hello world</form>. i think this is the default behaviour of the CF.
following is the response when i added "hello world" in ajax_form
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional
.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, follow" />
<meta name="keywords" content="joomla, Joomla" />
<meta name="description" content="Joomla! - the dynamic portal engine and content management system"
/>
<meta name="generator" content="Joomla! 1.5 - Open Source Content Management" />
<title>Radiology</title>
<link href="/radiology/templates/rhuk_milkyway/favicon.ico" rel="shortcut icon" type="image/x-icon"
/>
<link rel="stylesheet" href="/radiology/templates/rhuk_milkyway/css/template.css" type="text/css" /
>
</head>
<body class="contentpane">
<form name="ChronoContact_ajax_form" id="ChronoContact_ajax_form" method="post" action="http
://localhost/radiology/index.php?option=com_chronocontact&task=send&chronoformname=ajax_form"
>
hello world <input type="hidden" name
="64c74fc1157c3a10e4d0a5610b01bab2" value="1" />
</form>
<!-- You are not allowed to remove or edit the following 3 lines anyway if you didnt buy a license
-->
<div class="chronoform">
<a href="http://www.chronoengine.com">Joomla Professional Work</a>
</div>
<!-- You are not allowed to remove or edit the above 3 lines anyway if you didnt buy a license -->
</body>
</html>
how can i disable from tags in the form, or stop them from being posted
so what do you suggest, and i think ajax_form sends some really unnecessary code in response, where as it should only send "hello world".
#3- i have created a new form connected to that same table (jos_chronoforms_paidmember) but no input fields are showing up to update the that table, i also want to update another table's 3 fields from this table.
#4- yes you are rite on this i am working on this
also not related to the topic but login session is very small on this site, it takes me long time to type an reply (have to translate english to my language and then my language to english) and when i am done writing the reply and try to submit it it says to login again, i think you should increase login session time.
regards
salman
Hi Salman,
#2- try to add some specific delimiters around your output so that you can split the response later and get the real good response, example, make your form display :
#-+-+-+#hello world#-+-+-+#
then split it in response!
#3- if the form is connected to the table and the connection is enabled and the table has primary key and auto incrementing and the form fields names are the same as the table column names then this should work!
#4- OK!
try to write your answer and translate in a notepad file before login here๐
Regards
Max
#2- try to add some specific delimiters around your output so that you can split the response later and get the real good response, example, make your form display :
#-+-+-+#hello world#-+-+-+#
then split it in response!
#3- if the form is connected to the table and the connection is enabled and the table has primary key and auto incrementing and the form fields names are the same as the table column names then this should work!
#4- OK!
try to write your answer and translate in a notepad file before login here๐
Regards
Max
Hi Max
thankyou for continuous support
#2- great with your delimiter trick i have managed to get this working even in IE, ajax response is compatible with all browsers now. ๐.
here is the code, (i had to disable update in ajax, and manually set the html through onSuccess)
#4- i created multiple functions and combination of if else statements to manage the validation and ajax response, so they are sorted now , thanks again๐
#3- let me remind you that i want an update form , not a new record creation form, i have successfully created a form with form wizard and created a new table and connected to it and did all the ajax stuff and validations but now i need an interface where user can update his details in this form, for example if user is not present in the db then this form should show empty fields and then user will fill them and register but once user is registered then this same form should show his submitted data in the fields and if he changes any thing that is updated in the db rather then creating a new record. i think its simple and clear enough.
as you have suggested that i should create a new form and connect it to the db and enable this connection and that table should have primary key as auto increment and form_fields should be same as table column names, if i follow your suggestion i end up replicating the same settings as of my initial form, so instead of doing all this again i copied the form, which means it has all what is required to get it working but when i logged in and tried to open the form it showed empty fields, and did not fetched the data from db. if i am wrong on some point can you point out and give some example, i want to pull all the data from that table into this form so that user knows what he entered before. do i need to use some sql or php if yes then can you give some example, or do i have to use chronoconnectivity, but i think its used for admin things not front end editing and updating of tables.
********update********
i want some fields not to display in the update form like name, username, email, password, verify passwod (these are CB fields and user have to update them through CB), user should see the fields only from "jos_chronoforms_paidmember" table.
here are the list of fields
i think now you know what i want, so please give me some advise to achieve this , i tried to follow your instruction but not able to do it.
regards
salman
thankyou for continuous support
#2- great with your delimiter trick i have managed to get this working even in IE, ajax response is compatible with all browsers now. ๐.
here is the code, (i had to disable update in ajax, and manually set the html through onSuccess)
var url = "index2.php?option=com_chronocontact&chronoformname=ajax_form";
//var url = "/radiology/templates/radiology/example.php";
new Ajax(url, {
method: 'get',
postBody:'value='+username,
onSuccess: spliting,
//update: 'username_msg',
onComplete: showResponse
}).request();
return false;
}
function spliting(request)
{
var some = request.split("#-+-+-+#");
$('username_msg').setHTML(some[1]);
}
#4- i created multiple functions and combination of if else statements to manage the validation and ajax response, so they are sorted now , thanks again๐
#3- let me remind you that i want an update form , not a new record creation form, i have successfully created a form with form wizard and created a new table and connected to it and did all the ajax stuff and validations but now i need an interface where user can update his details in this form, for example if user is not present in the db then this form should show empty fields and then user will fill them and register but once user is registered then this same form should show his submitted data in the fields and if he changes any thing that is updated in the db rather then creating a new record. i think its simple and clear enough.
as you have suggested that i should create a new form and connect it to the db and enable this connection and that table should have primary key as auto increment and form_fields should be same as table column names, if i follow your suggestion i end up replicating the same settings as of my initial form, so instead of doing all this again i copied the form, which means it has all what is required to get it working but when i logged in and tried to open the form it showed empty fields, and did not fetched the data from db. if i am wrong on some point can you point out and give some example, i want to pull all the data from that table into this form so that user knows what he entered before. do i need to use some sql or php if yes then can you give some example, or do i have to use chronoconnectivity, but i think its used for admin things not front end editing and updating of tables.
********update********
i want some fields not to display in the update form like name, username, email, password, verify passwod (these are CB fields and user have to update them through CB), user should see the fields only from "jos_chronoforms_paidmember" table.
here are the list of fields
Table Create Table
-------------------------- --------------------------------------------------------
jos_chronoforms_paidmember CREATE TABLE `jos_chronoforms_paidmember` (
`cf_id` int(11) NOT NULL auto_increment,
`uid` varchar(255) NOT NULL,
`recordtime` text NOT NULL,
`ipaddress` text NOT NULL,
`cf_user_id` text NOT NULL,
`text_2` varchar(255) NOT NULL,
`text_3` varchar(255) NOT NULL,
`text_4` varchar(255) NOT NULL,
`text_5` varchar(255) NOT NULL,
`text_6` varchar(255) NOT NULL,
`text_8` varchar(255) NOT NULL,
`text_9` varchar(255) NOT NULL,
`text_11` varchar(255) NOT NULL,
`file_58` longblob NOT NULL,
`radio0` varchar(255) NOT NULL,
`text_18` varchar(255) NOT NULL,
`text_19` varchar(255) NOT NULL,
`text_20` varchar(255) NOT NULL,
`text_21` varchar(255) NOT NULL,
`text_23` varchar(255) NOT NULL,
`text_24` varchar(255) NOT NULL,
`text_26` varchar(255) NOT NULL,
`text_27` varchar(255) NOT NULL,
`text_28` varchar(255) NOT NULL,
`text_29` varchar(255) NOT NULL,
`text_31` varchar(255) NOT NULL,
`text_32` varchar(255) NOT NULL,
`text_37` varchar(255) NOT NULL,
`text_38` varchar(255) NOT NULL,
`text_39` varchar(255) NOT NULL,
`text_42` varchar(255) NOT NULL,
`text_43` varchar(255) NOT NULL,
`text_44` varchar(255) NOT NULL,
`text_45` varchar(255) NOT NULL,
`text_47` varchar(255) NOT NULL,
`text_48` varchar(255) NOT NULL,
`text_49` varchar(255) NOT NULL,
`text_51` varchar(255) NOT NULL,
`select_1` varchar(255) NOT NULL,
`select_35` varchar(255) NOT NULL,
`text_15` text NOT NULL,
`text_16` text NOT NULL,
`text_17` text NOT NULL,
PRIMARY KEY (`cf_id`)
) ENGINE=MyISAM AUTO_INCREMENT=18 DEFAULT CHARSET=utf8
i think now you know what i want, so please give me some advise to achieve this , i tried to follow your instruction but not able to do it.
regards
salman
Hi Salman,
I'm not sure I could understand all #3 but you can use Chronforms to update some table record if the form has some field which has the same name as the table primary key and loaded with the record value!
Regards,
Max
I'm not sure I could understand all #3 but you can use Chronforms to update some table record if the form has some field which has the same name as the table primary key and loaded with the record value!
Regards,
Max
Hi Max
thanks for replying despite your tight schedule
can you please please give me an example to demonstrate this thing.
if user 'A' has logged in then he should be able to edit his information, i mean only his data should be available to him in a form, and when he submits it should be update, i know it can be done but until you give any code example i cant start it.
Regards
Salman
thanks for replying despite your tight schedule
can you please please give me an example to demonstrate this thing.
if user 'A' has logged in then he should be able to edit his information, i mean only his data should be available to him in a form, and when he submits it should be update, i know it can be done but until you give any code example i cant start it.
Regards
Salman
Hi Salman,
Is this still the AJAX form ? if you want to update the user data then you can make another ajax_form2 and use an UPDATE SQL statement...I was talking about a normal form submission in my last post.
let me know
regards,
Max
Is this still the AJAX form ? if you want to update the user data then you can make another ajax_form2 and use an UPDATE SQL statement...I was talking about a normal form submission in my last post.
let me know
regards,
Max
HI max
sorry for this very late response
yes its the same ajax form, i duplicated that form as 'ajax_form2' but dont know how to use update SQL, and dont know how to load user specific data in that form (i think need to use read SQL statement).
can you please give me some example of both read and update sql and where to paste that code.
regards
salman
sorry for this very late response
yes its the same ajax form, i duplicated that form as 'ajax_form2' but dont know how to use update SQL, and dont know how to load user specific data in that form (i think need to use read SQL statement).
can you please give me some example of both read and update sql and where to paste that code.
regards
salman
Hi Salman,
the new ajax_form2 is just some way to execute the PHP code, and this is where you will put your PHP code which is doing the SQL queries!
the syntax of queries can be found in hundreds of posts here, the read statement will have the word "SELECT" and the update will have the word "UPDATE"
Regards,
Max
the new ajax_form2 is just some way to execute the PHP code, and this is where you will put your PHP code which is doing the SQL queries!
the syntax of queries can be found in hundreds of posts here, the read statement will have the word "SELECT" and the update will have the word "UPDATE"
Regards,
Max
This topic is locked and no more replies can be posted.