Jump to content

Bulk Edit - Javascript To Combine Fields


Recommended Posts

We have an App that ideally we would like a user to be able to use the Bulk Edit facility to amend a value within a field and have this applied to all applicable records.  So far so good.  But we also need that value added to another notes type field within each of the affected records.

 

In other datapages we use some javascript to concatenate the "value" to the notes field - you press Update and it all works great.  Ideally would love to be able to do this with a Bulk Edit facility.  However we have tried it and it did not seem to work. Perhaps the JS just wont work in this setting.

 

Anyone any ideas for how we might achieve same or similar effect?

 

George

Link to comment
Share on other sites

Hi George,

 

How are you doing?

 

I think, the following code can help (you can add a Header&Footer element to your Bulk Update form, select the Footer element, click the Source button and enter the code):

<SCRIPT LANGUAGE="JavaScript">
function concatenate()
{
var ResultFieldName = "Positions";

var position1 = document.getElementById("BulkEditPosition1").value;
var position2 = document.getElementById("BulkEditPosition2").value;

var allpositions = position1 + position2;

var inputName = "BulkEdit"+ ResultFieldName;
var checkboxName = "Enable"+ inputName + "Ckb";
document.getElementsByName(checkboxName )[0].checked=true;
document.getElementById(inputName).value = allpositions;
}

var myButtons = document.getElementById("BulkUpdateForm").getElementsByTagName("input");
var textValue = "";
var UpdateButton;
for(i=0;i<myButtons.length;i++)
   {
    textValue = myButtons[i].getAttribute("type");
    if(textValue=="button")
       {
        textValue = myButtons[i].getAttribute("value");
        if(textValue == "Update") UpdateButton = myButtons[i];
        }
    }
UpdateButton.onmouseover=concatenate;
</SCRIPT>

It works with editable fields, and doesn't work with Hidden fields. Enter the name of your result field instead of "Positions".

 

If you have any problems - feel free to ask, I'll be glad to help.

Have a nice day!

Link to comment
Share on other sites

  • 3 weeks later...

Hi Xiang and George,

Did this solution work? If so I'd like to adapt it for our problem below.

I've got a similar problem where we sometimes move passenger individually and have a button to record each stage of their progress and record location, who booked the progress and a timestamp.

However, when we move a number of passengers at the same time, the driver currently has to open up each passenger record and click on the button to update their details for stage of the journey.

Obviously we would like to use the bulk edit process but can't get our JS button to work in bulk edit mode.

I tried simply copying the bitton code from the details page - it gives me a pretty button but it doesn't update anything.

Any help would be appreciated.

 

Thanks

Martin

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...
×
×
  • Create New...