We have created two new string fields and converted into hyperlink fields to display. (updated the source code)
When we enter the link it works fine. But, when we try to delete its not getting removed.
What I am trying is -> I select the text/hyperlink and press delete, then when I click outside , it appears again.
If I save and re-open it, it actually deleted.
Like
Can you share what the code looks like that you added to make it a hyperlink? It's hard to say what is wrong without seeing that.
Ryan
Ryan Farley,
Thanks for your reply,
Please find the code below.
{
"operation": "insert",
"name": "ReferralForm",
"values": {
"showValueAsLink": true,
"controlConfig": {
"enabled": true,
"href": {
"bindTo": "getReferralFormLink"
},
"linkclick": {
"bindTo": "onExternalLinkClick"
}
},
"layout": {
"colSpan": 24,
"rowSpan": 1,
"column": 0,
"row": 0,
"layoutName": "Tab0fdbdf91TabLabelGridLayout149dcd0a"
},
"enabled": true,
"bindTo": "ReferralForm"
},
"parentName": "Tab0fdbdf91TabLabelGridLayout149dcd0a",
"propertyName": "items",
"index": 0
},
{
"operation": "insert",
"name": "ValueAddedAssessmentForm",
"values": {
"showValueAsLink": true,
"controlConfig": {
"enabled": true,
"href": {
"bindTo": "getValueAddedAssessmentFormLink"
},
"linkclick": {
"bindTo": "onExternalLinkClick"
}
},
"layout": {
"colSpan": 24,
"rowSpan": 1,
"column": 0,
"row": 1,
"layoutName": "Tab0fdbdf91TabLabelGridLayout149dcd0a"
},
"bindTo": "ValueAddedAssessmentForm",
"enabled": true
},
"parentName": "Tab0fdbdf91TabLabelGridLayout149dcd0a",
"propertyName": "items",
"index": 1
},
Selva,
Can you post the code to the getReferralFormLink and the onExternalLinkClick functions?
Actually I have one more field with the name 'ValueAddedAssessmentForm'
so I have updated the functions as below.
methods: {
getReferralFormLink: function() {
return this.getLink(this.get("ReferralForm"));
},
getValueAddedAssessmentFormLink: function() {
return this.getLink(this.get("ValueAddedAssessmentForm"));
},
onExternalLinkClick: function() {
return;
},
getLink: function(value) {
if (Terrasoft.isUrl(value)) {
return {
url: value,
caption: value
};
}
}
},
Selva,
Try changing the href part in the diff from this:
"href": { "bindTo": "getValueAddedAssessmentFormLink" }
to this
"href": { "bindTo": "ReferralForm", "bindConfig": { "converter": "getLink" } }
That should hopefully solve the issue.
Secondly, so the links open when clicked, add this to the onExternalLinkClick function:
onExternalLinkClick: function(url) { var link = document.createElement("a"); link.href = url; link.target = "_blank"; document.body.appendChild(link); link.click(); document.body.removeChild(link); return false; }
Ryan
Ryan Farley,
Thanks for your support,
I tried the given code, somehow it didn't work
Here is the complete code for the two hyperlink fields.
{
"operation": "insert",
"name": "ReferralForm",
"values": {
"showValueAsLink": true,
"controlConfig": {
"enabled": true,
"href": {
"bindTo": "ReferralForm",
"bindConfig": {
"converter": "getLink"
}
},
"linkclick": {
"bindTo": "onExternalLinkClick"
}
},
"layout": {
"colSpan": 24,
"rowSpan": 1,
"column": 0,
"row": 0,
"layoutName": "Tab0fdbdf91TabLabelGridLayout149dcd0a"
},
"enabled": true,
"bindTo": "ReferralForm"
},
"parentName": "Tab0fdbdf91TabLabelGridLayout149dcd0a",
"propertyName": "items",
"index": 0
},
{
"operation": "insert",
"name": "ValueAddedAssessmentForm",
"values": {
"showValueAsLink": true,
"controlConfig": {
"enabled": true,
"href": {
"bindTo": "ValueAddedAssessmentForm",
"bindConfig": {
"converter": "getLink"
}
},
"linkclick": {
"bindTo": "onExternalLinkClick"
}
},
"layout": {
"colSpan": 24,
"rowSpan": 1,
"column": 0,
"row": 1,
"layoutName": "Tab0fdbdf91TabLabelGridLayout149dcd0a"
},
"bindTo": "ValueAddedAssessmentForm",
"enabled": true
},
"parentName": "Tab0fdbdf91TabLabelGridLayout149dcd0a",
"propertyName": "items",
"index": 1
},
--------------Methods-------------------
getReferralFormLink: function() {
return this.getLink(this.get("ReferralForm"));
},
getValueAddedAssessmentFormLink: function() {
return this.getLink(this.get("ValueAddedAssessmentForm"));
},
onExternalLinkClick: function() {
var link = document.createElement("a");
link.href = url;
link.target = "_blank";
document.body.appendchild(link);
link.click();
document.body.removeChild(link);
return false;
},
getLink: function(value) {
if (Terrasoft.isUrl(value)) {
return {
url: value,
caption: value
};
}
}