Add option in front end

Status
Not open for further replies.

jo-ka

Member
Hello.
I have a DB Join element where I want to use Add option in front end feature. This element, lets call it fab_tickets___Contact is populated from a table that stores customers workers contacts.

My fab_tickets form have at first an DB Join element that get the customer Id (Label as Name) from the customers table, lets call it fab_tickets___Customer.

Then, the second DB Join element, fab_tickets___Contact, get the contacts from the contacts table, based on the previous customer selection (with Data Where and Ajax options active)

This is working perfectly.

Now, I want to enable the Add option in front end feature, which is also working but I want to know if its possible to automate the process, this is.

Once I have the customer selected on the fab_tickets form, when I click on the plus (+) button to add another contact to the contacts list (filling the contacts popup form), is there a way to have the customer field of the fab_contacts form automatically filled with the fab_tickets___Customer data when the popup is displayed?

Because, if I don't have this, I need to first select the customer, so the contact info can be filled in. I'm looking to find a way to avoid that someone erroneously select the wrong customer.

Is there a way to accomplish this?

Thank's in advance.
 
A week or so ago I committed a change to the front end add ...

https://github.com/Fabrik/fabrik/co...eba1a31#diff-e0bfa758782210995c927ada04bf3481

... which adds the current form data to the url that opens the front end add popup. So you can get those values from the input to use as element defaults for your Contacts form. For example, if you have a join to the same customer table on the contacts form ...

Code:
return JFactory::getApplication()->input->get('fab_tickets___Customer_raw', '');

If the form is being opened from the front end add link, that input variable will be there, and return a value to pre-set the element.

-- hugh
 
Dear hugh, thanks for the update.
I've downloaded the latest fabrik-master update and uploaded it to the server. I've then checked the changes you've committed and the files are updated.

So, after I've defined the Contacts Customer to DB Join, linking to the same table as you've suggested, and set the code as you wrote. But when I call the Contacts form from the front end, the default value doesn't appear.

I don't know if I'm doing the thing correctly, but I think that it might be an error on mu EVAL expression, or some bug on the DB Join element.

And I'm saying this because I was also trying to set a default option on another field (not related to this one) on a DB Join element, following an example you've posted here http://fabrikar.com/forums/index.ph...items-into-fabrik-elements.47971/#post-249319, but also with no results.

What am I doing wrong?

Thanks in advance

upload_2017-12-24_10-29-22.png
 
The other DB Join I have is a simple status element, which I would need to have a default value like Ready.
I use this code, and the default element value doesn't return the Ready status, but the first entry of the list, or the Please Select option if enabled.

$db = JFactory::getDBO();
$sql="SELECT interventionstatus.Status FROM interventionstatus";
$sql.=" WHERE interventionstatus.Status =";
$sql.=" 'Ready'";
$db->setQuery($sql);
return $db->loadResult();

I don't know if the code is wrong or not, but I've tested it on a calc element and it worked, but I can't get it working on a simple element. I know it might not be related, but it looks like it is and it's just for comparison.

Also this code doesn't work on a simple element for default Eval option, even with the Please Select option disabled:

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query = "SELECT `Status` FROM interventionstatus WHERE `Id` = 9";
$db->setQuery($query);
return $db->loadResult();


Is it related?

Thanks in advance.
 
Last edited:
A week or so ago I committed a change to the front end add ...

https://github.com/Fabrik/fabrik/co...eba1a31#diff-e0bfa758782210995c927ada04bf3481

... which adds the current form data to the url that opens the front end add popup. So you can get those values from the input to use as element defaults for your Contacts form. For example, if you have a join to the same customer table on the contacts form ...

Code:
return JFactory::getApplication()->input->get('fab_tickets___Customer_raw', '');

If the form is being opened from the front end add link, that input variable will be there, and return a value to pre-set the element.

-- hugh
Dear Hugh...
Still can't get this working, and I don't know why...

Can you help please?
 
Can you help please?

Yes, I can, but not immediately. Standard support is 3 working days response time ... you posted at about 5am yesterday ... Sunday ... Christmas day ... I don't even respond to Pro support on Christmas day ... and I'm trying to take 25th/26th off, although I am responding to stuff which has quick answers and doesn't require me setting up complex and time consuming test cases (like this does).

Bump this tomorrow (Tue 27th) or the day after, when I'm back at work and have cleared Pro issues.

-- hugh
 
Yes, I can, but not immediately. Standard support is 3 working days response time ... you posted at about 5am yesterday ... Sunday ... Christmas day ... I don't even respond to Pro support on Christmas day ... and I'm trying to take 25th/26th off, although I am responding to stuff which has quick answers and doesn't require me setting up complex and time consuming test cases (like this does).

Bump this tomorrow (Tue 27th) or the day after, when I'm back at work and have cleared Pro issues.

-- hugh
Dear Hugh.

Yes, I know the limitations of Standard support and, of course, I understand the special Season we're living. I'll bump this later on today.
BR
 
Good morning:

The site is suporte.zematek.pt and here's the details:

Form where I want to add option from the front end: fab_tickets.

Here I have a DBJoin element first pointing to entities table, getting the KeyID field (it's not the id field, but it's the unique identifier) - fab_tickets___Customer.

Then, in the same form, I have another DBJoin element, that will watch the fab_tickets___Customer element and link to the customerscontacts table, where I'll be searching the related customer contacts - fab_tickets___EntityContact.

This is the element where I want to Add Option from the Front End, which will open the customerscontacts form and immediately fill the customerscontacts___CustomerKeyId field with the fab_tickets___Customer info.

Thank's in advance.
 
Well, no that the Xmas, New year, 3 day support have passed...

Friendly bump!
I'm on the road at the moment, I'll take care of it tomorrow, when I get home. I'm somewhere in the Smokies Mountains atm, heading home.

Sent from my HTC6545LVW using Tapatalk
 
Your site doesn't have the changed databasejoin.js and window.js code from this commit, that I referenced in my first response:
-- hugh

Dear Hugh...
I've just pulled the update once more and now I think it's OK (you can use eXtplorer component to access the files)
Still, I can't get this option working, and I don't know what am I doing wrong.

Can you please help, maybe creating one simple working example with two lists and some elements so I can check what's wrong.

Thank's in advance.
 
I just tried it, and it seems to be working OK:

https://www.screencast.com/t/3kZjSPzZrqVL

Apologies if any of that is proprietary, let me know and I'll delete the screencast.

-- hugh
OK... I see what's happening!

I've been using Firefox web browser all the time. Then I've checked on Chrome, Edge and IE and it's in fact working. But not on Firefox.

Then, on Firefox, I've forced https and suddenly it start working. I cant' explain why!!!!

On the other browsers it work with and without https. On Firefox, only with https! Then I've checked on other computer and it worked also with and without https...

I don't know, but by know I think we can close this ticket. Ans yes, please, as soon as you can, please delete the screencast.

Thanks for all your patience.

BR
 
Did you clear your JS cache? Remember that when you update the JS, your browser may still have the old JS cached. So using a different browser (or changing http to https or vice versa) will load the fresh JS.

You can either do it in the browser, or temporarily enable "bust JS" in the Fabrik debug settings, which will force all; browsers to load Fabrik's JS from scratch on every page load.

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top