shehzad_ucdavis
shehzad_ucdavis

Reputation: 135

How to format quoations in JSON to execute link

I have a json configuration file like:

   "type": "script",
        "label": "coreapps.archivesRoom.printSelected",
        "script": "emr.fragmentActionLink(${project.parent.artifactId},\"downloadPatientHistory\", \"download\", {{patient.patientId}})",
        "icon": "icon-download",
        "order": -25,
        "require": "!visit && !patient.person.dead",
        "requiredPrivilege": "Task: coreapps.createVisit"  
    }

I want 'script' to link to href="javascript:emr.fragmentActionLink(lfhcforms," downloadpatienthistory",="" "download",="" 7)

But my HTML view doesn't recongize the correct link. Note that in the below screenshot the link is incomplete. Any hints?

enter image description here

Upvotes: 0

Views: 47

Answers (2)

me_astr
me_astr

Reputation: 1042

You can use combination of ' and " to represent a string.

Any of the following will work fine for you

href='javascript:emr.fragmentActionLink(lfhcforms," downloadpatienthistory",="" "download",="" 7)'

href="javascript:emr.fragmentActionLink(lfhcforms,' downloadpatienthistory',='' 'download',='' 7)"

Just figure out which one is easire for you to make in your case.

Upvotes: 1

julian soro
julian soro

Reputation: 5228

It looks like your href is a javascript function. I would use single quotes so that it looks like this

href="javascript:emr.fragmentActionLink(lfhcforms,' downloadpatienthistory',='' 'download',='' 7)"

Since your data source is that JSON file, you should parse/serialize your JSON object, and alter the type.script property, changing those double quotes to single. Parse it, searching for \" and replace with '.

Upvotes: 2

Related Questions