I have a query regarding form handling in oxid.
I want to extend register form with few extra fields. Like I have 2 radio buttons on main register form, When user clicks a particular radio button, an additional form data will be asked to fill up respective to radio btn. Now I want to store those data on different table using the same user ID when user press “SAVE” button.
As I have gone through oxcmp_user.php and register controller I could not find how to handle it.
have a look at newsletter subscriptions during registration, there is a checkbox and the data is stored in different table, just like you need.
Get the checkbox name and find it’s occurencies in php soruce code.
Thanks @vanilla_thunder for yous suggestion but somehow I couldn’t find the code where it performs insertion operation to the table.
Here I have appended the part of code what I am doing but some how its not filling any data, I think I am missing something here like where it should indicate that create OXID to table and insert the form data on table.
its a MVC pattern, data is saved into database when you call save() on your model.
Lets say, you created custom model class oxbuser, to map object properties to table columns you need to pass table name in model constructor, like its done here:
// Constructor
public function __construct()
{
parent::__construct();
$this->init(‘oxbuser’);
}
here is the error which i gets on the page:
mysqli error: [1054: Unknown column ‘oxusername’ in ‘where clause’] in EXECUTE (SELECT oxid FROM oxbuserWHERE ( oxusername = ‘’ ) AND oxshopid = “oxbaseshop” , ) with user root
in this case there might be some side effects from original oxuser functions, that try to use database fields oxuser model uses, but your model does not have. You will have to adjust your table structure to oxuser
Thanks @vanilla_thunder, I have fixed the problem. I think the problem was due to the extension of ‘oxuser’ class. Now I am extending from ‘oxBase’ class and it works fine. Appreciate the support.