I'm trying to create a link within javascript
, which when clicked, sets the value of a public render parameter
within WebSphere Portal
.
For some reason I see actual code in the generated href
instead of value thats suppose to be passed in.
Heres how I create the link within javascript
..
var a = document.createElement('a');
var linkText = document.createTextNode('This is a link');
a.appendChild(linkText);
a.title = 'This is a link';
a.href = '[Plugin:RenderURL pr1.mode="set" pr1.type="public" pr1.key="sources" pr1.value=' + JSON.parse(http.responseText).uniqueID + ']';
This is what I see in the Firefox Inspector devtools ..
<a href="p0/IZ7_9O5CH940L8BE00AQSQ97LA0811=CZ6_9O5CH940LON880AAN4OSND00N6=MEsources!QCLQCAJSON.parse(http.responseText).uniqueIDQCAQCL==/#Z7_9O5CH940L8BE00AQSQ97LA0811" title="This is a link">This is a link</a>
I understand this is likely an escaping issue, but i've tried so many variations, how should I properly create the href
for my link?
Sample for setting prp using a form, same idea as anchor above ..
// create form to set PRP
var f = document.createElement('form');
f.setAttribute('method', 'GET');
f.setAttribute('action', '[Plugin:RenderURL copyCurrentParams="true"]');
var filters = document.createElement('input');
filters.setAttribute('type', 'hidden');
filters.setAttribute('name', 'sorting');
filters.value = 'This is my new value!';
var s = document.createElement('input'); //input element, Submit button
s.setAttribute('type', 'submit');
s.setAttribute('value', 'Set');
f.appendChild(filters);
f.appendChild(s);
document.body.appendChild(f);
f.submit();