Jump to content
ChristofK

[SOLVED] Bulk Edit - Input value not being saved

Recommended Posts

Hi all,

I cannot seem to overcome an issue with the use of Javascript on a bulk edit screen.

There is a basic little script I wrote to control when users should be notified about changes done in bulk. It should simply prevent notifications from being sent if the user did not alter the initial delivery status of a product.

While the script itself executes just fine upon each change to the delivery status field, the value that gets inserted into the text field which toggles the actual notifications isn't being saved when I hit "Update". It works if I manually type in Yes or No, but not if it's done via the script. I suspect this has to do with Ajax in one way or another, about which I lack the necessary knowledge to troubleshoot, unfortunately.

 

    var pSDeliveryOld = document.getElementById("BulkEditParticipation_List_2016_Delivery_status").value;
    var dStatusChangeNotification = document.getElementById("BulkEditParticipation_List_2016_Notification_DStatusChange");

    function statusCheck() {
      var pSDeliveryNew = document.getElementById("BulkEditParticipation_List_2016_Delivery_status").value;

      if(pSDeliveryOld !== pSDeliveryNew) {
        dStatusChangeNotification.value = "Yes";
      } else {
        dStatusChangeNotification.value = "No";
      }

      console.log("System to send notification: " + dStatusChangeNotification.value);

    }

    document.getElementById("BulkEditParticipation_List_2016_Delivery_status").onchange = statusCheck;

Could one of you experts out there help me get the Yes/No value saved in the table?

Many thanks in advance!

Best,

Kristof

Share this post


Link to post
Share on other sites

Hi Meekee,

Thanks for your input. While it was certainly a good place to start, the modifications described on the impacted areas page are of no help since the script does actually run. It's not an issue with how it's triggered as it executes flawlessly upon hitting update.

As for disabling Ajax altogether, the system won't allow me. I suspect that if you want to have the bulk edit feature enabled, AJAX is a must, so Caspio Bridge won't let me untick the box while having that on.

Any other suggestions that come to mind?

Thanks & best

Kristof

Share this post


Link to post
Share on other sites
31 minutes ago, Vitalikssssss said:

Hi @ChristofK,

Did you consider creating a validation with a Triggered Action feature?

https://howto.caspio.com/tables-and-views/triggered-actions/

This type of validation will require relatively simple Trigger on record update.

Here is an example:

365b164ecff3.png

 

Hope this helps.

regards,

vitalikssssss

Haven't thought about this, as I wasn't sure I could do validations on the same field (compare onload and onsubmit states). Will look into it, though, seems like a viable alternative!

Thanks for sharing this!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...