 |
07-30-2010, 11:43 PM
|
#1
|
|
Member
Supporter
Join Date: Nov 2009
Location: Winnipeg, MB, Canada
Posts: 57
Thanks: 10
Thanked 2 Times in 2 Posts
|
Calculation Element Problem with Calc on Save Option
I'm sure I had my Calculation Elements working before, but now they won't pick up {tablename___elementname} data from other fields on the form on a New Form submit.
It works if I've already submitted data and return to the form and save again, but I thought I could access the newly created element values in the calculation element and save those as well in a New Form submission.
Can someone set me straight on this?
Cheers,
Jeremy
|
|
|
07-31-2010, 07:07 AM
|
#2
|
|
Senior Member
Join Date: Dec 2008
Location: Biarritz, France
Posts: 2,031
Thanks: 151
Thanked 281 Times in 245 Posts
|
Can you show us your code to see if there's something obviously wrong?
When you say "now they won't pick up......": what happened exactly before "now", did you update Fabrik?
|
|
|
08-01-2010, 12:14 AM
|
#3
|
|
Member
Supporter
Join Date: Nov 2009
Location: Winnipeg, MB, Canada
Posts: 57
Thanks: 10
Thanked 2 Times in 2 Posts
|
Quote:
Can you show us your code to see if there's something obviously wrong?
When you say "now they won't pick up......": what happened exactly before "now", did you update Fabrik?
__________________
-- tom
|
Hi Tom,
I've attached one actual sample where the query works fine if I use it with no save selected (results show in the table for all records), but fails to display on new if yes is selected (no result in table).
I did a simpler sample with just a "return '{tablename___elementname};'" from the same table which again works (displays in the table) if no save is selected, but fails to save a value if yes is selected.
I've attached some screenshots of my settings used.
I had been working on a complicated form that will have multiple forms pointing to the same table, I noticed this wasn't working as I expected, but didn't realize it had also stopped working in other forms I'd already completed and tested. I did a Fabrik update yesterday to see if that would help, but no luck.
Aside from that, I'm running on a Rochen server and I had some problem with accessing the email templates I'd made in Joomla articles because of the access level setting in Joomla - I don't know that I've changed anything else, but I may have done something...
I should mention that while Save is on yes, this also doesn't work on a new record or an edit of an existing record at this time, though I'm sure yesterday, it was working if I did an edit.
Any help would be much appreciated...
Jeremy
|
|
|
08-01-2010, 09:41 AM
|
#4
|
|
Senior Member
Join Date: Dec 2008
Location: Biarritz, France
Posts: 2,031
Thanks: 151
Thanked 281 Times in 245 Posts
|
I'm not sure to understand why it's not working as you want but I just want to clarify something:
The option is "Calc on Save only: Yes/No" not "Save: Yes/No". I know the difference sounds trivial but still, it's different 
|
|
|
08-01-2010, 09:37 PM
|
#5
|
|
Member
Supporter
Join Date: Nov 2009
Location: Winnipeg, MB, Canada
Posts: 57
Thanks: 10
Thanked 2 Times in 2 Posts
|
To clarify:
If I choose: Calc on Save = No, then it works as expected
If I choose: Cac on Save = Yes, then it does not work
|
|
|
08-02-2010, 04:51 PM
|
#6
|
|
Administrator
Join Date: Jan 2007
Location: La Rochelle France
Posts: 9,628
Thanks: 131
Thanked 437 Times in 413 Posts
|
have you tried setting you code to output some debug information, somehting like:
PHP Code:
$db->setQuery('your query here'); echo $db->getQuery(); echo '<pre>'; print_r$(_POST); exit;
are you sure the datbase join element whose data you are getting is visible and editable by the user?
|
|
|
08-02-2010, 07:11 PM
|
#7
|
|
Member
Supporter
Join Date: Nov 2009
Location: Winnipeg, MB, Canada
Posts: 57
Thanks: 10
Thanked 2 Times in 2 Posts
|
Hi Rob,
I tried the debug code sample (screenshot attached). The form doesn't do anything on posting, it just posts as usual, with the calculation field empty.
Quote:
|
are you sure the datbase join element whose data you are getting is visible and editable by the user?
|
In the example, the city is a dbase join field selected by the user in the same form. The lookup in the calculation uses the
_raw
value from this selection to pull another bit of field data from the city table. So it is both visible and editable by the user.
I would have thought that the form itself would have access to all the data, even if I was hiding a field to lookup some data related to the user and using this hidden data to add another looked up value in a hidden field - is this not the case?
- Jeremy
|
|
|
08-04-2010, 02:59 PM
|
#8
|
|
Administrator
Join Date: Jan 2007
Location: La Rochelle France
Posts: 9,628
Thanks: 131
Thanked 437 Times in 413 Posts
|
Quote:
|
The form doesn't do anything on posting, it just posts as usual, with the calculation field empty.
|
Are you sure you are editing the element which is associated with the form? I tested this and adding the exit; will definately stop the validation code and show any output you have echo'd out.
|
|
|
08-04-2010, 09:39 PM
|
#9
|
|
Member
Supporter
Join Date: Nov 2009
Location: Winnipeg, MB, Canada
Posts: 57
Thanks: 10
Thanked 2 Times in 2 Posts
|
Hi Rob,
I double checked this, and I thought maybe the code had an error and was being ignored - so I rewrote it to something simpler. It now fails to display the form and displays a blank screen.
Now using this code:
Code:
$query = "SELECT tax_rate FROM cities WHERE id = 1";
$db->setQuery($query);
echo $db->getQuery();
echo '<pre>';
print_r($_POST);
exit;
So still not working as expected....
- Jeremy
|
|
|
08-05-2010, 08:13 AM
|
#10
|
|
Administrator
Join Date: Jan 2007
Location: La Rochelle France
Posts: 9,628
Thanks: 131
Thanked 437 Times in 413 Posts
|
you would needd
Code:
$db =& JFactory::getDBO();
at the beginning, also its best when testing a site to put the error reporting (global config->system) to maximum to catch any php generated errors.
|
|
|
 |
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Unfuddle SVN |
| Project: |
Fabrik 2.x |
| Rev |
Comment |
| 4047 |
fixed <= / >= url filters were incorrectly quoting numeric values |
| 4046 |
changed: table group by dropdown in admin now allows you to select the raw version of the element |
| 4045 |
added: table option to deleted joined data when deleting records
fixed: several xhtml strict/css validation issues |
| 4044 |
fixed: using user element in non default connection, any prefilter set up to use said element would generate an SQL error |
| 4043 |
changed: db join element's concat statement now run through parsemessageforplaceholder() |
| 4042 |
fixed: email form plugin. Generated error if sending from admin whilst using an article template |
| 4041 |
fr-FR admin language file: element plugin - fabrikgooglemap |
| 4040 |
added: digg & rating elements now work with js turned off
fixed: some xhtml strict validation errors |
| 4039 |
fixed: incorrect quoting of dbjoin table filter autocomplete hidden fields |
| 4038 |
changed: plugin controller - pluginAjax() - now allows for noajax=1 where by $app does redirect (allows for use of ajax... |
|