× Form Help

Populating a Joomla 'user' lastvisitDate field to form.

  • hambakwe
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 46
  • Thank you received: 0

hambakwe created the topic: Populating a Joomla 'user' lastvisitDate field to form.

I have a form which is populated when a 'Select' field (itself populated from a table) has one of it's values selected.

I have managed to get all fields I require populated with the information for the selected user and from two tables using the following Action Script in the Select field Advanced tab:

function ff_select_clib_action(element, action)
{
switch (action) {
case 'click':
jQuery.ajaxSetup({
cache: false
});
jQuery.ajax({
type: 'GET',
url: ' www.xxx.com/clib.php ',
data: 'id=' + jQuery('#ff_elem5918').val(),
success: function(data){
var name = data[0].name + ' ' + data[0].middlename + ' ' + data[0].lastname;
if(data[0].clib_role == "Client")
jQuery("#ff_elem5983").val('Managed Account Client');
if(data[0].clib_role == "Sub IB")
jQuery("#ff_elem5983").val('Sub Introducing Broker');
jQuery("#ff_elem5919").val(data[0].clib_status);
jQuery("#ff_elem7492").val(data[0].clib_notes);

jQuery.ajax({
type: 'GET',
url: ' www.xxx.com/clib_status.php ',
data: 'id=' + data[0].clib_status,
success: function(data){
jQuery("#ff_elem5920").val(data[0].clib_process);
jQuery("#ff_elem6140").val(data[0].pl_access_level);
var id = parseInt(data[0].id)+1;
jQuery.ajax({
type: 'GET',
url: ' www.xxx.com/clib_status.php ',
data: 'id=' + id ,
success: function(data){
jQuery("#ff_elem6042").val(data[0].clib_process);

}
});

}
});

}
});
break;
default:;
} // switch
} // ff_select_clib_action

The three URLS execute database queries to load * variables.

So far this works perfectly.

I wish to populate one further field with the selected users 'lastvisitDate' value from the 'users' table. I have added the following lines to the script but it does not populate the form field:

jQuery.ajax({
type: 'GET',
url: ' www.xxx.com/user.php ',
data: 'id=' + data[0].lastvisitDate,
success: function(data){
jQuery("#ff_elem5921").val(data[0].lastvisitDate);

(The URL loads the 'user' table values)

I'm attaching a pic of the form for further clarity.

Any help or thoughts would be much appreciated.
#230699
Attachments:
  • Posts: 2154
  • Karma: 67
  • Thank you received: 264

DarkoCujic replied the topic: Populating a Joomla 'user' lastvisitDate field to form.

Hey,

I'd have to see the output from user.php to tell you exactly why it isn't displaying. If it's in the table, and if you're getting all the data from the table, then it should be there. Maybe you're simply not accessing it correctly.

Would you mind providing backend access to darko.cujic@crosstec.org along with the name of the form?

Regards,
Darko

Satisfied with our support? PayPal tips
===========
Need to renew Pro Support? Buy Here!
===========
Satisfied? Consider a membership!
===========
Like us on Facebook
===========
Support Crosstec and get ALL EXTENSIONS and professional support for just $5. Here!
#230700
  • hambakwe
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 46
  • Thank you received: 0

hambakwe replied the topic: Populating a Joomla 'user' lastvisitDate field to form.

Here is the content of the user.php:

<?php
define( '_JEXEC', 1 );
define( 'JPATH_BASE', realpath(dirname(__FILE__).'/' ));
require_once ( JPATH_BASE .'/includes/defines.php' );
require_once ( JPATH_BASE .'/includes/framework.php' );

$id = $_GET;
$database = &JFactory::getDBO();
$sql = "SELECT * FROM prosite_users WHERE id = $id";

$database->setQuery( $sql );
$result=$database->loadAssocList();
header('Content-type: application/json');
header('Access-Control-Allow-Origin: *'); // CORS Settings
echo json_encode($result);

?>

I will email access to you now.
#230702
  • Posts: 24
  • Thank you received: 0

mlangamer replied the topic: Populating a Joomla 'user' lastvisitDate field to form.

Hello can you help me? I posted the request but until now I have not had an answer.

crosstec.org/en/forums/1-forums/125334-m....html?start=6#232062
#232156
Moderators: ForumSupporttomeperica
Time to create page: 0.068 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here