Custom Block Based on Legacy Form

Permalink 1 user found helpful
Hey all. I'm hoping this is an easy answer for someone. I am trying to create a custom block based on the legacy form block. Ive copied it to my application/blocks folder, changed the name and all the name spaces, modified the db.xml file, and pointed the controller (and all other references) to the new database. BUT no matter what I do, the questions I add to this new block are all added to the original btFormQuestions table in the database. Is there some other reference to the original table in there that I am not seeing? This is step one of, at least for me, a pretty involved modification (experiment really) so you can imagine my frustration getting stuck already.

Secondly... My goal is to have the form (or forms) populate a site cookie rather than 'submit' then after all the information is collected, the user is taken to a page where information, relevant to their input, is displayed. Is there a better way to do this?

Thanks in advance.
C

 
linuxoid replied on at Permalink Reply
linuxoid
Re. #1, make sure that both the db.xml and block controller point to the same database.

db.xml:
<table name="btYourTableName">

controller.php:
protected $btTable = 'btYourTableName';

Re. #2, If you're asking how to get user data without refreshing a page, I guess you can either use AJAX+PHP or JavaScript to set cookies and then to redirect to another page. What's wrong with submitting a form? You can process the data in a simple way with PHP and then redirect to another page. Or were you asking a better way to get user data without cookies?
Chrouglas replied on at Permalink Reply
Hey thanks for your reply.

Re #1 Yes... the table names are changed and match. There is another reference to the tables within mini_survey.php and I changed that to match as well.

Re #2 There really is no data collected for permanent use (ie in the form results dashboard). I'd just like the user to select a couple of options (ie form radio buttons) and then when done, have specific information based on their input displayed on a 'results' page.

Maybe I could build this from scratch but I thought using the legacy form block as a base would be easier. Or maybe not :)