Auto Generate numbers

getting this error when I remove the .

ent')-.>set

------

Notice: Undefined variable: db in /folders/plugins/fabrik_form/php/php.php(453) : eval()'d code on line 6

Fatal error: Call to a member function quote() on null in /folders/plugins/fabrik_form/php/php.php(453) : eval()'d code on line 6
 
Ah, seems to be one more typo
$myQuery->update('mtoofflinestudent')->set('offlinenumber = ' . $myDb->quote($myId))->where('id = ' . $myDb->quote($rowid));
 
Great it works now :) THANK YOU SO MUCH.
Now the auto number is saved to the element after I hit save.

I have small issue, but not sure how to solve this:
I have added receipt plugin to the form, so on save the user will get the following info:

Your Name: {mtoofflinestudent___First_Name} {mtoofflinestudent___Last_Name}
Your Email: {mtoofflinestudent___Email}
Your Student ID#{mtoofflinestudent___offlinenumber}

with some text.

now, the email is sent out without issue with the text and the other info such as: full name and email address.
but the student ID is empty;

empty.jpg

Not sure why the student number the one is auto generated not been included in the email.

Please help :(
 
Hmmm, what order are the plugins in?

I think you'd have to have the receipt plugin after the PHP one, as they both run onAfterProcess, and they run in the order they are defined in your plugin settings. So probably the receipt runs first, before the number has been generated.

Also ... I think you'll have to set the element's value in the form data, as that's what the receipt plugin is using. That code you have only pokes the data into the database, it doesn't update the data in memory. So after executing the query, so this:

Code:
$formModel->formDataWithTableName['mtoofflinestudent___offlinenumber'] = $myId;
$formModel->formDataWithTableName['mtoofflinestudent___offlinenumber_raw'] = $myId;

-- hugh
 
Hi, thank you again for your effort to help me.
I have the plugin in in the following order:
PHP
receipt
after.PNG

I also added the code to the element value:eek:fflinenumber


$formModel->formDataWithTableName['mtoofflinestudent___offlinenumber'] = $myId;
$formModel->formDataWithTableName['mtoofflinestudent___offlinenumber_raw'] = $myId;

value.PNG

but not sure if that is what do you mean by:
[Also ... I think you'll have to set the element's value in the form data, as that's what the receipt plugin is using. That code you have only pokes the data into the database, it doesn't update the data in memory. So after executing the query, so this:]

please see the screen.

Still not able to have the student number into the email sent to the student.

Thank you again.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top