TOPIC:

replace the value User 8 months 4 days ago #240882

  • Topic Author
  • DAVIDPL
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 108
  • Thanks: 0
It is possible to replace the value getUser = (888) of the following code, by a variable or by the value of a field in the form.

<?php $user = JFactory::getUser(888); return $user->get('name'); ?>

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

replace the value User 8 months 4 days ago #240929

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 807
Hi,

since this would be like a default value, rendered upon form display, you can alter it using javascript on the fly using an action script.

For example:

Go to the field's advanced tab -> Action Script that is supposed to change the value of the field above.

Click "Custom" and check "Change"

Click "Create Code Framework"

In the resulting code skeleton, right after "case 'change':", add this:
ff_getElementByName('FIELDNAME').value = element.value;

FIELDNAME, would be the name of the field (not title) that holds your value from above and element.value would just replace its content with the value from the field where the action happens.

This example is for text fields and dropdowns, for other types you need to determine their values based on their types.

Regards,
Markus

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

replace the value User 8 months 3 days ago #240954

  • Topic Author
  • DAVIDPL
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 108
  • Thanks: 0
Hello
Maybe it wasn't explained well.

What I am trying is the following:

When I enter the data in the field: A

A = customer code, B = customer name.

Automatically obtain the customer's name in field B on the form.

With the following code in the value field it forces me to make it fixed, but what I want is for it to be variable.

customer: 888
<? php $ user = JFactory :: getUser (888); return $ user-> get ('name'); ?>

client: logeado
<? php $ user = JFactory :: getUser (); return $ user-> get ('name'); ?>

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

replace the value User 8 months 3 days ago #240994

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 807
You mean you want to pick a certain user and not use the currently logged on user?

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

replace the value User 8 months 3 days ago #240996

  • Topic Author
  • DAVIDPL
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 108
  • Thanks: 0
Hi

If right
any user

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

replace the value User 8 months 2 days ago #241029

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 807
Hi,

please see the form attached.
Download, unzip and install it in BreezingForms => Configuration => Package Installer.

In manage forms, try it out. At least that's how I understood how it should work.

The most important parts in terms of code are located in the actionscript of the search button and in form => advanced => more options => form pieces.

File Attachment:

File Name: usersearch.zip
File Size:10 KB


Regards,
Markus
Attachments:

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

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.050 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

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

Special Offer

Summer 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!