last_insert_id not showing in form_submit_message

colinvv

Member
Is there a reason I cannot display the last id inserted (auto-incremented key) into a table? I am using the format {item_id} in the message... but the server has MYSQL version 5.0.27.
 
placeholders should use this format:

{tablename___elementnname}

for the primary key we also have an alternative to this format which is:

{rowid}

so I'd suggest trying one of those

Cheers
Rob
 
I see that we are calling "_lastInsertId" in the oTable class and the "insertid" of the fabrikDb class. And a Mambo fix in "fabrik_table.class.php" line #269 where we do a SELECT MAX(id) to get the last_insert_id.

I came across a note in the MySQL 5.0 docs that suggests a quickfix for this problem in early versions.

http://dev.mysql.com/doc/refman/5.0/en/insert-select.html

"SELECT id FROM mytable WHERE id IS NULL;"

Colin
 
None of these are working in the form_submit_message option for the form...
rowid={rowid}
item_id={item_id}
jos_th_item___item_id={jos_th_item___item_id}

Colin
 
PHP built On: Linux mail4 2.6.18-1.2798.fc6 #1 SMP Mon Oct 16 14:37:32 EDT 2006 i686
Database Version: 5.0.27
PHP Version: 5.1.6
Web Server:
Apache/2.2.4 (Fedora)
WebServer to PHP interface:
apache2handler
Joomla! Version:
Joomla! 1.0.15 Stable [ Daytime ] 22 February 2008 23:00 UTC
 
I tested on another form with no table join... and {item_id} works! (it displays the 'last_insert_id' in the form_submit_message area)
 
Could you be more precise with what you are doing? I'm unsure as to where exactly you are trying to use the placeholder

Thanks
Rob
 
Sorry, I should have detailed the whole thing... but I thought you may have a "quick-fix" for me.

I have a Joomla 1.0 component, TaskHopper and task management and support ticket tracker, installed and am trying to create a custom Fabrik "Submit New Support Ticket" form. I have the basics of the form working well... but then I tried to add a "file upload" element. That's when it stopped working properly.

It seems that if I attempt to run a "On Change" JavaScript to the "File Upload" element, it destroys the "data" type of the element and will not post correctly. I have "File Name", "File Description" and "File Type" fields required by the TaskHopper table that I'm trying to fill from that "File Upload" element.

Any ideas on how I can manage/modify the post data from the "File Upload" element? Let me know if you what a detailed look at the site.

Thanks,
Colin
 
I'm not sure that adding an onchange event to the fileupload element would work, I've not tried but I know that fileupload elements tend to severely limit how you can interact with them for security reasons.

What I would do is:

create three hidden fields for the "file name", "file description" and "file type" options

Then I would edit my form and:

select process php script: "As soon as form submitted (CURL)"
and in the 'PHP code to execute on form submission'

something like this:

Code:
global $_FILES;
// get information about the uploaded file whose full element name is 
// 'tablename___elementname';
$fileinfo = $_FILES['tablename___elementname'];

// insert its file type and name into your hidden fields
JRequest::setVar('tablename___filetype', $fileinfo['type'], 'post');
JRequest::setVar('tablename___filename', $fileinfo['[FONT=monospace]name[/FONT]'], 'post');

you may need to alter the varaible names to match the fields you have in the taskhopper component.
 
Back
Top