I have a field that, if null, needs to contain the global field value of a Contact name field. Have tried several variations, in several events, such as exit of the global field, but nothing is happening. It's set to JavaScript and what's needed is if the Completed_By field is null, it needs to be filled in with the Contact field before it's submitted. I think I want it to simply default to the contact name unless the person completing the form is different than who they list for company contact, and then they can change that Completed_By value. Thank you.
if ((Completed_By.isNull) || (Completed_By.rawValue == undefined))
{
Completed_By.rawValue = Contact.rawValue
}
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
If you are using FormClac then this should be the correct syntax:
if (Completed_By.isNull or Completed_By eq "") then
$ = Contact
endif
If you are using JavaScript, I would expect this to work:
if (Completed_By.rawValue == null || Completed_By.rawValue == "") {
this.rawValue = Contact.rawValue;
}
This JavaScript version could be further simplified by using the identity test (===):
if (Completed_By.rawValue === null) {
this.rawValue = Contact.rawValue;
}
Hope that helps,
Niall
Views
Replies
Total Likes
Update, if I use below in FormCalc/ calculate event, it returns the value of the Contact field ok, but it doesn't allow me to change the value of the Completed_By field, it reverts to the Contact. Only need it to contain Contact value before submitting if the user has not supplied a 2nd name. Thank you again.
this.rawValue = Contact.rawValue
Views
Replies
Total Likes
Update, with the help of this link, http://forms.stefcameron.com/2006/05/19/is-that-field-empty/, was able to work it out in FormCalc, and it now behaves the way it's needed. Here is what worked.
if (Completed_By.isNull | Completed_By == "")
this.rawValue = Contact.rawValue
endif
Views
Replies
Total Likes
Hi,
Just a quick note. You should not need the .rawValue in FormCalc and the equivalent to "this" in FormCalc is "&".
So,
$ = Contact
Niall
Thank you, it doesn't seem to be working for me, possibly I'm not understanding where to revise what I had, here is what I tried, but nothing happened. I tried both the & and $, as below it looks like both are mentioned so was not sure the proper revision needed, thanks.
if (Completed_By.isNull | Completed_By == "")
$ = Contact
endif
Views
Replies
Total Likes
Hi,
If you are using FormClac then this should be the correct syntax:
if (Completed_By.isNull or Completed_By eq "") then
$ = Contact
endif
If you are using JavaScript, I would expect this to work:
if (Completed_By.rawValue == null || Completed_By.rawValue == "") {
this.rawValue = Contact.rawValue;
}
This JavaScript version could be further simplified by using the identity test (===):
if (Completed_By.rawValue === null) {
this.rawValue = Contact.rawValue;
}
Hope that helps,
Niall
Views
Replies
Total Likes
Thank you, the last one worked great. For some reason the first two kept putting the value to a 0 if my cursor left the field if I overwrote the default contact value, so am going with the 3rd, thank you again.
Views
Replies
Total Likes
Views
Likes
Replies