Jump to content

How to reference field in Bulk Edit and select it for updating using javascript


Recommended Posts

Hi, I'm trying to use js to get the user's system date/time on their local computer, in the Bulk Edit section of a tabular datapage. I've used this code in various other datapage types but cannot get it to work in the Bulk Edit footer. 

In the footer of Bulk Edit, the field is Comments_Actual_Read_Date but it's not capturing the v_TimeStamp value. Does Bulk Edit need something besides EditRecord to reference a field?

Here's the code I've got:

<SCRIPT LANGUAGE="JavaScript">

 /* Declaration and initialization */

 Stamp = new Date();

 var v_TimeStamp;

 Hours = Stamp.getHours()

 Mins = Stamp.getMinutes();

 /* Attach a prefix with digit '0' if the minutes is less than 10. */

 if (Mins < 10) {

   Mins = "0" + Mins;

 }

 /* Construct the value of the v_TimeStamp variable in the format m/d/yyyy hh:mm */

 v_TimeStamp=('' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate() + "/"+Stamp.getFullYear() + ' ' + Hours + ":" + Mins);

 /* Field name - Date_Charge is referred with a prefix - EditRecord */

 document.getElementById("EditRecordComments_Actual_Read_Date").value = v_TimeStamp;

</SCRIPT>

EDIT: Ah, I found a post showing you use 'BulkEdit' instead of 'EditRecord' but now the issue is if js is used to populate the Bulk Edit field it doesn't check the left column 'select' box automatically so the user has to do it manually. This defeats the purpose and is clunky. Is there a way to 'select' the field in Bulk Edit using js? 

Link to comment
Share on other sites

I found the right answer to select the field to be Bulk Edited, as well as put a value in the field. You have to reference the check box for that field. Here's the full code in case anyone needs it: 

<SCRIPT LANGUAGE="JavaScript">

 /* Declaration and initialization */

 Stamp = new Date();

 var v_TimeStamp;

 Hours = Stamp.getHours()

 Mins = Stamp.getMinutes();

 /* Attach a prefix with digit '0' if the minutes is less than 10. */

 if (Mins < 10) {

   Mins = "0" + Mins;

 }

 /* Construct the value of the v_TimeStamp variable in the format m/d/yyyy hh:mm */

 v_TimeStamp=('' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate() + "/"+Stamp.getFullYear() + ' ' + Hours + ":" + Mins);

 /* Field name - Date_Charge is referred with a prefix - EditRecord */

 document.getElementById("BulkEditComments_Actual_Read_Date").value = v_TimeStamp;

var checkboxName = "Enable"+ "BulkEditComments_Actual_Read_Date" + "Ckb";

document.getElementsByName(checkboxName )[0].checked=true;

</SCRIPT>

 

Link to comment
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...
 Share

×
×
  • Create New...