Okay
  Public Ticket #1542836
One-Line Edit Field NOT WORKING!
Closed

Comments

  •  3
    Rhonda Stark started the conversation

    I have a column setup in SQL as VarChar(25) and on wpDataTables as One-Line Edit. If I enter more than 25 characters into the column and save, I receive the message that says it saved the entry.

    But when the table is refreshed, the data has NOT been saved for that column .. nor for any other column I changed on the modal.

    Please help as I need to get this working for my client!

  •  471
    Isidora replied

    Hi Rhonda,
    Thank you for your purchase.

    Yes that is the case if you are editing data in table. You have to make changes some code in file wp-content/plugins/wpdatatables/controllers/wdt_ajax_actions.php arounf line 356 you will find this 

    if (!empty($wpdb->last_error)) {
        $returnResult['error'] = __('There was an error trying to update the row! Error: ', 'wpdatatables') . $wpdb->last_error;
    } else {
        $returnResult['success'] = $idVal;
    }
    

    and you have to replace it with this

    if (!empty($wpdb->last_error) || $res === false) {
        $returnResult['error'] = __('There was an error trying to update the row! Error: ', 'wpdatatables') . $wpdb->last_error;
    } else {
        $returnResult['success'] = $idVal;
    }

    Now it will be show up message that there is a error when they try to edit or insert data that have more then 25 characters.

    Sorry for inconvenience,

    Best regards.


    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  3
    Rhonda Stark replied

    Why isn't this in your code to begin with? I consider this a bug.

    I'm sorry but that is a condition that should be tested for as part of the product. I feel that I shouldn't have to test for that  condition .. it should be part of the data validation as part of the plugin.

    Is there a reason it cannot just truncate the data instead of rejecting the entire update/insert?



  •  471
    Isidora replied

    Hi Rhonda,

    Sorry for misunderstanding, but yes that is the bug and we provide you solution for handling.

    We are using wordpress built in functions for inserting and updating data in database which have validation of the data that returns information are this functions executed(add new row in database or update existing row) and on our side was missed this case when wordpress is not returning error.

    We are working on improvement of plugin every day and one of the tasks is better error handling that will be implemented in one of next updates.

    Thank you for your purchase.

    Best regards.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  3
    Rhonda Stark replied

    OK .. that makes sense. I just wanted to make sure that it would be updated in the next release and I wouldn't lose my changes.

    Thanks again!

    Rhonda

  •  3
    Rhonda Stark replied

    OK .. I added the code and it is giving me the error but it is still going to the hook .. do_action('wpdatatables_after_frontent_edit_row', $formData, $idVal, $tableId)

    this is where i have my code to send the email as i assume that the row was updated .. but it really wasn't as the data wasn't saved to the table yet.

  •  3
    Rhonda Stark replied

    I added the following condition for the do_action ...

        if ($returnResult['error'] == '') {
           do_action('wpdatatables_after_frontent_edit_row', $formData, $idVal, $tableId);
        }

    Also .. as a suggestion for improvement of the plugin .. perhaps add a max column length field on the backend and add the code to validate :)

  •  471
    Isidora replied

    Hi Rhonda,

    I am glad that you found a solution.

    Thank you for your suggestion.We carefully follow customers requirements and try to implement most of them if they appears in requests from time to time so we will add to our idea list and look into some possible solutions on plugin side for one of next versions.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables