• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Updating an exisiting form entry

Updating an exisiting form entry 13 years 4 months ago #15611

  • liam3
  • liam3's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 10
I have the usual form set up,
how if it is possible to do it so that i can call an existing entry from a form and update it?

eg can i list the unique id(drop down box?), select that forms entry details and then edit/update the info in that form

thanks
The administrator has disabled public write access.

Re: Updating an exisiting form entry 13 years 4 months ago #15633

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
Unfortunately there is no built-in or easy way of doing this. Advanced scripting knowledge will be required.
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Re: Updating an exisiting form entry 13 years 4 months ago #15638

Hello,
Yes, I would really like to see this as well!

What we're talking about is CRUD operations. For those of you unfamiliar with this, that stands for Create, Review (view), Update (edit), Delete...

Right now, RSForm Pro does an excellent job on form creation, setting the layout of forms, and allowing users to view their submissions. It has terrific scripting capabilities.

So that's the "C" and the "R" part of CRUD!

Now we need the "U" and the "D" part. Actually, these capabilities are present already in the back end. We just need to get it working on the front end.

I definitely think there's a market for this in the Joomla extension world. What would it take to develop such a thing?

Thanks,
Matthew
Last Edit: 13 years 4 months ago by matthew.schenker.
The administrator has disabled public write access.

Re: Updating an exisiting form entry 13 years 4 months ago #15654

  • matt
  • matt's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 136
  • Thank you received: 14
Hi!

I have missed the feature to edit and delete from frontend for some years now in RSForm Pro.

Matt
The administrator has disabled public write access.

Re: Updating an exisiting form entry 13 years 3 months ago #15879

  • learnthrusong
  • learnthrusong's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 26
  • Thank you received: 3
Hi there,

I'm going to be implementing this kind of thing myself. I have a custom table for projects that I run into which my form currently inserts a new row with about 40 columns as well as doing some updates and inserts to other tables.

How I intend to do this is;
1 - Create a new select list field (I'll call it 'form_mode' and add some values that represent the different modes you want, i.e. 'edit'/'new'. Put this at the top of your form

2 - ADD a select list that pulls entire rows from whatever table in your DB the submissions are stored. Make sure that the value of the select is the primary key (id) of your submission

3 - Add a button that does a header location back to your form + the value of your choice in the above 2 fields so it would look like:
STRUCTURE: [full_url_to_your_form]&[first_url_var]={form_mode:value}&[submission_to_edit]={submission_to_edit:value}
EXAMPLE: "http:www.yoursite.foo/index.php?option=com_rsform&formId=1&form_mode=edit&submission_to_edit=1"

N.B. Call your url parameter anything you want but AVOID using joomla variable names not to screw a load of things up!!!

4 - In your PHP script that runs on load, check for its existence...
if (isset($_GET['form_mode'])){ 
  // SET A VAR YOU CAN USE
  $form_mode = $_GET['form_mode'];
  // NOW THROW A SWITCH OR IF/ELSE BLOCKS THAT DETERMINE WHERE TO REDIRECT USER 
  switch($form_mode){
     case  "edit" :
        // OBVIOUSLY YOU NEED TO CHECK FOR A VALUE TO EDIT TOO BUT JUST AS EXAMPLE
            // AFTER CHECKING, QUERY DB TO SELECT * FROM YOUR TABLE WHERE ID = ID YOU SELECTED TO EDIT
         header('Location:http:www.yoursite.foo/index.php?option=com_rsform&formId=1&form_mode=edit&submission_to_edit=1');
     // IF YOU ONLY HAVE 2 MODES, YOU JUST NEED TO SET THE OTHER AS DEFAULT
     default : //this will just load form for you to create a new submission
          break;
     }
}
The only thing that I'm not 100% on at the moment is loading that array into the fields although that should be pretty straight-forward!

Definitely use the $db->loadAssoc(); on your query. Then targeting your values will be as easy as using whatever $var you set + it's Key which will be your fieldname from the db. So, if you initialise your results as $result, you can target your values using $results, $results, $results and so on...

In theory, you should just be able set the $_POST array to the values you pull in the query although, I've not tested this yet!!!

Obviously, when you come to process your form, you'll need to evaluate what mode you are in to determine whether to insert a new row or update an existing one...

Hope this helps!

Gez
Last Edit: 13 years 3 months ago by learnthrusong. Reason: ADD info
The administrator has disabled public write access.

Re: Updating an exisiting form entry 13 years 3 months ago #15880

  • learnthrusong
  • learnthrusong's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 26
  • Thank you received: 3
To tidy up your form a little, you could hide the select list to pick a submission to edit if NOT in EDIT MODE.

You could extend the security of this further by specifying a joomla user group who can edit. The best place to do that check would be on the page load, inside of the if isset on the mode...

This way, only those with the edit permission will be able to access the edit page for a submission.

Again, hope this helps!

Gez
The administrator has disabled public write access.

Re: Updating an exisiting form entry 12 years 9 months ago #17969

  • nahagel
  • nahagel's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Dear learnthrusong,
did you manage to implement your solution succesfully? Does it work?
I need possibility to edit submisions via front-end and can't find the solution.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!