Immediately 'save form' when creating new

Dear Fabrik,

It's been a while since I've worked at this project.

Basically I have the following I want to accomplish: I have a therapist who as a set of default therapies. Then he wants to create a treatmentplan for a client, and he uses one or more default therapies to fill his new treatment plan.

What I have set up is a 3 page form:
  • first page: he chooses the client and gives the plan a name and a date (he has to press 'apply' to save the form here already
  • second page: he chooses the default therapy he wants to add, then presses 'add to plan' - this runs a database script copying some rows into this new plan. Of course to do this I needed to save the form first by pressing apply, so that I actually have a {rowid}. He than has to press refresh (and not save or apply)
  • third page: he then can change the loaded values still if wanted.
Now I want get rid of a number of steps:
  1. To have to press 'apply' in step 1. So I want to get a {rowid} when I create a new entry.
  2. I have to refresh page manually. I can probably get this done with javascript after copying the database tables.
That is option A. Of course option B would be something like creating a little 'wizard', where you just choose client, give it a name, multiselect from the default therapies, and that it then creates a new entry when saved and open it for editing.
Any ideas are more than welcome. Also different approaches etc. A prefill form thing is not possible as it contains many join-selects etc.
An example page of a client is here:
http://ortho2.newspectives.nl/index.php?option=com_fabrik&view=details&formid=19&rowid=1&Itemid=112
(you need to login first via the homepage http://ortho2.newspectives.nl with the details provided ).
In the top right section you can add new, and go into the 'wizard' I have put there now.
Thanks. Hein
 

Attachments

  • screen-capture-34.png
    screen-capture-34.png
    64.2 KB · Views: 201
  • screen-capture-35.png
    screen-capture-35.png
    45.2 KB · Views: 195
  • screen-capture-36.png
    screen-capture-36.png
    108.3 KB · Views: 189
Well, you seem to have summarized your options.

The way I've done this in the past is to use the content plugin, using Sourcerer to insert some embedded PHP in the article, which pre-creates a row in the table by hand in Step 1 (using the standard J! database API), filling in whatever defaults you want, which gives you a rowid you can then insert in {fabrik view=form id=X rowid=$rowid} which you echo from the embeded PHP.

If your embedded PHP also checks the query string for a rowid=X, it can then either use the query string rowid for displaying a prexisting form, or (if no rowid-X on the query string) do what I described above.

-- hugh
 
For those who are interested,

I created a small form which has the userID and a checkbox select for the plans, then this goes to a php files which creates a row, gets the ID, and then copies the right tables, and then continues to edit that new form. (if my description makes sense).

Hein
 
Thanks for following up, it really does help other users searching for similar solutions.

Just to clarify, what do you mean with "goes to a PHP file"?

Do you redirect the first form to an entirely custom PHP file, which then redirects to the form's component link?

-- hugh
 
Yes, I post this miniform to a custom php file, which does some database actions like creating the new form and filling it with values from the "standard therapies", and then forwards to the newly created form where the values show up, it can still be edited, and then saved.
 
OK, cool. Yup, that's kind of a variation on the approach I described, of using the content plugin, with some embedded PHP to generate the exact plugin string on the fly.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top