Saving Changes from one Table (List) to different Table (List)

altnetwork

Member
I am looking to be able to do the following.

Table (List) A - List of records that are viewed by the end user, but edited by me. I would like to have the end user be able to submit changes to a record from List A. I would like those changes to be saved to a different List. I would then review those changes. Finally, I alone would make the final edit to List A.

Thought / Idea:

End User is viewing a record from List A. While viewing the record the end user wishes to correct or add information to the viewed record. The end user would, in the record view, click on a link or button. This would take the information from that record and place in a form that is linked to a different list. The end user would then be able to make corrects/additions to the record in the second list/table.

I would then review the corrections/additions from the second list/table and make the changes/additions to the original list.

Is this possible and if so, how can I set this up? Or, is there a different way of doing this then what is described above.
 
One thing you might try is a redirect, using the "append form data" option. You would have to have a "copy" of your list which isn't an actual copy, eg has a different table. And on each matching element, you could set up an eval'ed default, which does something like...

return $this->app->input->get('originaltable___thiselement') ;

In other words, default it to the value passed on the query string with the redirect from the original table. Except for the 'id' element. You would want to add an FK element, like originaltable_id, which holds that, so you know which row was being edited.

Sent from my HTC6545LVW using Tapatalk
 
I see the option in the form for the "append from data", but how would you apply this to a view?

"You would have to have a "copy" of your list which isn't an actual copy, eg has a different table. And on each matching element,..."
I was thinking along this line. I do have a second table with the same element names.

"...,you could set up an eval'ed default, which does something like...

return $this->app->input->get('originaltable___thiselement') ;"


I am lost at this point, Sorry.

One thing you might try is a redirect, using the "append form data" option. You would have to have a "copy" of your list which isn't an actual copy, eg has a different table. And on each matching element, you could set up an eval'ed default, which does something like...

return $this->app->input->get('originaltable___thiselement') ;

In other words, default it to the value passed on the query string with the redirect from the original table. Except for the 'id' element. You would want to add an FK element, like originaltable_id, which holds that, so you know which row was being edited.

Sent from my HTC6545LVW using Tapatalk
 
I wasn't thinking straight. Doing it that way would require a way of short circuiting the form processing, so it didn't save to the original table, but still ran the redirect plugin. And I can't think of a way of doing that.

Yeah, so we're back to "I can't think of a way without custom coding".

I have a couple of ideas for approaches to take. Depending on the size and complexity of the form (how many elements, which element types, are there joins / repeating groups), maybe a couple of hours max.

Sent from my HTC6545LVW using Tapatalk
 
Question: is there a way to take value from a variable and have it fill in a field in a add form?

Like:
<div class="fabrikElementReadOnly" id="missouri_cemetery___condition_ro">Very Good
</div> - The Value being Very Good and assign the value to an predefined text element in an add form when it opens?

Hope this make sense.
 
If you are asking what I think you are, then yes, that's what I was describing with the eval'ed defaults on elements, which let you run php code to set the default (the value the element has on a new form).

Sent from my HTC6545LVW using Tapatalk
 
I did, in post #5. That example grabs whatever is in the query string that is loading this page for 'originaltable___thiselement'.

return $this->app->input->get('originaltable___thiselement') ;

So if you were loading your "copy" as ...

?option=com_fabrik&view=form&formid=1213&originaltable___thiselement=foobar

... then the copy of 'thiselement' would get set to "foobar".

-- hugh
 
So, I am grabing the element from the Bootstrap Details Template shown below. default.php/Default Template View

Code:
<?php
endforeach;

/* Elements Defined */
// echo "<pre>";
$elements = $group->elements;

$name = $elements['name']->element;
?>

<?php echo $name; ?>

When do I place {return $this->app->get('name');

and

?option=com_fabrik&view=form&formid=1213&name=name


I did, in post #5. That example grabs whatever is in the query string that is loading this page for 'originaltable___thiselement'.

return $this->app->input->get('originaltable___thiselement') ;

So if you were loading your "copy" as ...

?option=com_fabrik&view=form&formid=1213&originaltable___thiselement=foobar

... then the copy of 'thiselement' would get set to "foobar".

-- hugh
 
No, I'm talking about the element settings, "Default", with "Eval" set to Yes.

No template editing.

-- hugh
 
Then how would the end user who is viewing the data in the view form go from this to the edit form?

You said something like "?option=com_fabrik&view=form&formid=1213&originaltable___thiselement=foobar". Is this for getting the user from the view form to the edit form?

No, I'm talking about the element settings, "Default", with "Eval" set to Yes.

No template editing.

-- hugh
 
I was just answering your question:

Question: is there a way to take value from a variable and have it fill in a field in a add form?

I thought you had some clever idea on how to get the data into the query string.

See my post #6 for the answer to:

Then how would the end user who is viewing the data in the view form go from this to the edit form?

In other words, it'd need custom coding.

-- hugh
 
Can you explain how this works?

?option=com_fabrik&view=form&formid=1213&originaltable___thiselement=foobar
 
Last edited:
I found a post which is what I am trying to do but save the information to a different table...."add-custom-button-next-to-submit.46758/#post-242135"

Will this work?

also, what does it mean to change an element to = 1?
 
That post doesn't help, as all it does is provide a second button that just sets a specific element value to 1 before submitting. It doesn't help with submitting to a different list.

As I said before, I simply cannot think of a way of doing this without extensive custom coding.

-- hugh
 
I was able to get it working! I am having one issues I need help addressing.

This is what I did to get it working:

I am using [return $this->app->input->get('originaltable___thiselement') ;] in the element settings, "Default", with "Eval" set yo Yes which is working.

I am passing the data by url [?originaltable___thiselement=Test%20Data] which is filling in the element field.

The problem is that the data this is filling in the element is showing as [TestData] and not [Test Data]. The space is being removed!

How to I fix this? Thanks
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top