TOPIC:

Init Script - Element Values are Null 2 years 2 weeks ago #255508

  • Topic Author
  • davidtilton
  • Offline
  • New Member
  • New Member
  • Registered
  • Posts: 17
  • Thanks: 0
Thank you so much, this is exactly what I needed. The value is added to the field before the init script runs so everything works now. I appreciate all the help!

Please Log in or Create an account to join the conversation.

Init Script - Element Values are Null 2 years 2 weeks ago #255514

  • Topic Author
  • davidtilton
  • Offline
  • New Member
  • New Member
  • Registered
  • Posts: 17
  • Thanks: 0
Hi, I have one more question. It seems that the php query that you offered does not return the element value for the specific user that is logged in, so I am getting a value back that isn't correct.

Is there a way to query for it in a way like "select <element_name> from <record_table> where username = <username>" ?

Thanks.

Please Log in or Create an account to join the conversation.

Init Script - Element Values are Null 2 years 2 weeks ago #255516

  • Topic Author
  • davidtilton
  • Offline
  • New Member
  • New Member
  • Registered
  • Posts: 17
  • Thanks: 0
I should add that I already have the username stored as an element in the form.

Please Log in or Create an account to join the conversation.

Init Script - Element Values are Null 2 years 2 weeks ago #255528

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Registered
  • Posts: 12079
  • Thanks: 780
Hi,

something like this:
$this->execPieceByName('ff_InitLib'); //Include BreezingForms Library
$db = JFactory::getDBO();//Get Database Object
$user = &JFactory::getUser();//Get user Object

$db->setQuery('SELECT value FROM #__facileforms_subrecords WHERE name="elementname" AND username='.$user->username);

$result = $db->loadResult(); //load the result from the query
ff_setValue('ElementName', $result); // populate the value in the form. Change ElementName to the real name of your element

Hope this helps

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

Init Script - Element Values are Null 2 years 2 weeks ago #255594

  • Topic Author
  • davidtilton
  • Offline
  • New Member
  • New Member
  • Registered
  • Posts: 17
  • Thanks: 0
Hi,

This approach does not seem to work and based on how the records are stored in the database I wouldn't expect it to work. It doesn't seem possible to add multiple criteria to the where clause in this case but please clarify if I missed something.

I found this old entry that describes searching through records for specific criteria: crosstec.org/en/forums/3-breezingforms-f...records.html?start=0

I want to be clear because what is described in the thread linked above seems overly complicated for what I'm trying to accomplish.

To summarize, I have users entering information in the multiple-page form. Each time a page is completed, there is an element in that page that gets set to "Complete". When the user logs in next time and the form loads, I want the form to check the last page that was set to "Complete" and navigate to that page.

So far, attempting to get the value of the "Complete" element in the form init script failed because the value is empty during the init process and only populates after the script is complete. In the past I could access the value of the "Complete" element during the init script and this is how I was doing it (I don't know why it no longer works). Is there an easy way to do this that I'm missing?

Thanks.

Please Log in or Create an account to join the conversation.

Init Script - Element Values are Null 2 years 2 weeks ago #255602

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Registered
  • Posts: 12079
  • Thanks: 780
Hi,

basically, you can add multiple criteria to WHERE with AND.

Maybe I make a mistake with the code, please try it like this:
Please try it like this:
$this->execPieceByName('ff_InitLib'); //Include BreezingForms Library
$db = JFactory::getDBO();//Get Database Object
$user = &JFactory::getUser();//Get user Object

$db->setQuery('SELECT value FROM #__facileforms_subrecords WHERE name="elementname" AND username= "$user->username" ');

$result = $db->loadResult(); //load the result from the query
ff_setValue('ElementName', $result); // populate the value in the form. Change ElementName to the real name of your element

If this won't work, then please check this:
crosstec.org/en/forums/3-breezingforms-f....html?start=0#128489

Hope this helps

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Time to create page: 0.058 seconds

Support Chat

Join our Discord chat and enter the Crosstec channels for live-support, chat forums and interact directly with the community!

After joining, please enter the Crosstec Area and use the #crosstec-support or #crosstec-general channels.

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Subscribe to news and updates!

Special Offer

Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

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 and enter the Crosstec channels to receive live support and talk directly to the team!