Jump to content

[FYI] How to create an "Editable formula"


Recommended Posts

Just wanted to share  a workflow on how to create a an editable formula field. This will allow you to calculate the value for a field based on other fields (Formula) or manually input the desired value.

1. Create a virtual field that will contain your formula.
2. Add a header and footer in your DataPage and disable the HTML editor on the footer.
3. In the footer put the following code:

<script>
document.querySelector("input[id*='VIRTUAL_FIELD_ID']").onchange = function() {myFunction()};

function myFunction() {

var virtual_val = document.querySelector("input[id*='VIRTUAL_FIELD_ID']").value; 
document.querySelector("input[id*='FIELD_ID']").value = virtual_val;
}
</script>

note: The field that is going to be used for the "field_id" will be the actual field that will store the calculation.

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...