Jump to content

Hiding fields needed to populate other fields using java


Recommended Posts

Hello.

The following javascript works fine, in that it takes an email address ("Email") and copies it to a field ("AckEmail") that is used to populate an acknowledgment email upon the checking of a checkbox ("IssueDeclineEmail") in a record.

However, in order for this to work, the Email record needs to be in edit mode (as does the AckEmail field) making it possible for a user to delete the Email value where it will be lost on an Update of that record.

Is there anyway to have this javascript work while the field "Email" is hidden or not visible to the user, so there is no possibility of messing it up?

Thanks for any help here.

<script>

function assignemail() {

if (document.getElementById
("EditRecordIssueDeclineEmail").checked) {
var emailnew=document.getElementById("EditRecordEmail").value;
document.getElementById("EditRecordAckEmail").value=emailnew;
}
else {
document.getElementById("EditRecordAckEmail").value="localhost@localhost";
}
}

document.getElementById
("EditRecordIssueDeclineEmail").onclick=assignemail;

</script>

Regards,

paloo

Link to comment
Share on other sites

  • 4 years later...

Hello Paloo,

You can have the field in a "display only" format so no one is able to edit the email field anymore however you should replace the below line:

var emailnew=document.getElementById("EditRecordEmail").value;

with

var emailnew=[@field:Email];

instead.

Hope that helps,

londoncity

Link to comment
Share on other sites

  • 6 years later...

One problem with this is that if you use the rules to hide the information, it won't work as a parameter and pass information such as the OP wants it to do. If it is hidden with rules, the values just disappear. The issue is similar using Display Only. If someone is using an element or virtual field JUST to access information and pass it to another field like I am trying to do, you need to use that Virtual Field as a cascading autocomplete, meaning you cannot set it to display only.

I have a virtual field that is configured as a Cascading Autocomplete. I need to keep this on the submission form because it is essential to one of my other fields, however I don't want it visible on the form. If anyone can help, please let me know!

Link to comment
Share on other sites

  • 3 weeks later...

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