This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 3

Problem


  1. SeanToro
    Member

    Hey,

    I created an application form and had a dropdown with the positions available for them to select. Today I deleted all the positions and re-entered a bunch. And now it has lost all the previous positions that were in the applications prior. Is that supposed to happen? Really wish I would've known, as now I don't know out of hundreds of applications which position they're apply for.

    Posted 11 years ago #
  2. Lokidog
    Member

    Hi!

    If you have kept the form as a whole and only edited the dropdown within that form you should retain a record of what people have chosen prior to your editing in the "entries" list under manage forms in the Admin Panel. Export it to .xml just to be on the safe side as well.

    Posted 11 years ago #
  3. SeanToro
    Member

    Wish that were true, but when I go into each entry, the field is blank.

    Posted 11 years ago #
  4. jhinkle
    Member

    I'm pretty sure if you delete a field, it deletes all the related information in the database pertaining to that field as well.

    If you want to keep the data in the database pertaining to that field, you have to "hide" it on the form by selecting "Admin only" on the properties of that field. Then create a new field with all your new data.

    Posted 11 years ago #
  5. Lokidog
    Member

    SeanToro. You could ask your server host to restore your Databse (If you don't have a copy yourself to restore) from an earlier save for you, sometime before your edit, that could restore all the info to "as it was". Don't forget to ask them to do the tables AND the content.

    Posted 11 years ago #
  6. yuniar

    I think we can restore this through some modification. Assuming you are using v3.2, edit your "includes/entry-functions.php" file search around line
    359 for this code:

    $query = "select element_id,option_id,option from ".MF_TABLE_PREFIX."element_options where form_id=? and live=1 order by position asc";

    change it to become:

    $query = "select element_id,option_id,option from ".MF_TABLE_PREFIX."element_options where form_id=? order by position asc";

    then search around line 716 for this code:

    $query = "select
    						element_id,
    						option_id,
    						option
    					from
    						".MF_TABLE_PREFIX."element_options
    				   where
    				   		form_id=? and live=1
    				order by
    						element_id,position asc";

    change it to become:

    $query = "select
    						element_id,
    						option_id,
    						option
    					from
    						".MF_TABLE_PREFIX."element_options
    				   where
    				   		form_id=?
    				order by
    						element_id,position asc";

    those two modifications should re-display all your deleted values of your dropdown.


    MachForm Founder

    Posted 11 years ago #
  7. SeanToro
    Member

    I got this error when going into the entries after modifying the code...

    SQL: [109] select element_id, option_id, option from ap_element_options where form_id=? order by element_id,position asc Params: 1 Key: Position #0: paramno=0 name=[0] "" is_param=1 param_type=2 Query Failed: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option from ap_element_options where form_id='4' order by element_id,position as' at line 1

    Posted 11 years ago #
  8. yuniar

    Ah...yes, this forum can't display backtick characters, hence the above code are incorrect. All option keywords should be enclosed with backticks characters.

    Here is the correct code for the first one:
    http://pastie.org/4213906

    and the second one:
    http://pastie.org/4213910


    MachForm Founder

    Posted 11 years ago #
  9. SeanToro
    Member

    That worked! Thanks so much!

    Posted 11 years ago #
  10. aminor
    Member

    I am having the same problem but the fix posted here does not solve it. I am only getting this issue with one table. I have checked the database and don't find the data error that the syntax error is referring to. Is there a way to edit the code pertaining only to one table?

    Posted 11 years ago #

RSS feed for this topic

Reply