Save date and username each time a breezingform record is edited

  • pjfroelofs
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 43
  • Thank you received: 0

pjfroelofs created the topic: Save date and username each time a breezingform record is edited

LS
Each time a user edits a breezingform record via content builder.
I would like to log the username and date.

The previous date and username can be overwritten.

At this moment I use 2 editable breezingform elements.
Date: with format (%Y-%m-%d) and value (...)
Username: value (<?php return JFactory::getUser()->get('name',''); ?>)

When a user makes a NEW record, then the date and username are automatically filled.

When a user EDITS a record via content builder:
- The date is automatically overwritten by the new date
- The username stays unchanged

So the user has to manually change the username.
And has the option to manually override the prefilled date.


What I would like, are two breezingform elements, that are not visible in the form.
So the user can not change date or username.
And in the background they are automatically filled when saving the contentbuilder record.

Maybe this is possible with some html code in the Submit pieces -> End Submit section?

Please advice,
Patrick
#234781
  • mihaela
  • Away
  • Administrator
  • Administrator
  • Posts: 1938
  • Karma: 67
  • Thank you received: 234

mihaela replied the topic: Save date and username each time a breezingform record is edited

Hello,

I understand the problem.

Either way, there is a way to set the current user's username automatically when editing the form so that user doesn't have to change it manually.

Here are instructions how to make the username update on edit.

Navigate to form's Advanced properties > More options > Form pieces and in Before Form section set Type to Custom.

In the code area below put code similar to this one:
$this -> execPieceByName('ff_InitLib');

$usern = JFactory::getUser()->get('name','');
ff_setValue('username', $usern );

echo '<script>
setInterval(setlist, 500);
var test = " '. $usern . ' ";
function setlist() {
       ff_getElementByName("username").value = test;
       }
</script>';
NOTE: In order for this to work "username" has to be the exact name of the field where username should be displayed.

To hide the fields, you can simply go to Advanced properties of the "username" field and check the "Turn off" checkbox.

Let me know whether this works as you wanted.

Regards,

Mihaela
#234788
Moderators: ForumSupporttomeperica
Time to create page: 0.059 seconds

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

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€

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!

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