SAPUI5 Link sending two parameters - hyperlink

I have a SAPUI5 Link on my page and I want to use it to call another php file with two parameters. As far as I can see, I am formatting the XML properly but when I try to include the second parameter in the 'href' property, I get an error that the XML is not formatted properly.
Here is the XML for the link - I have modified the href to remove sensitive server information:
<Link id="pdfLink" xmlns="sap.m" text="PDF" href="https://../scripts/pdf/index.php?yr={/yr}&qtr={/qtr}" target="_blank"></Link>
When the URL is triggered, it should look similar to this in the browser:
https://../scripts/pdf/index.php?yr=2015&qtr=1
This will launch the index.php file with the parameters, if entered manually. If I remove the '&qtr={/qtr}' (or even just the &), then I don't get an error that the XML is invalid, but of course then the 'qtr' parameter is not sent.
I also tried switching the & with a ; which did not cause the invalid XML error, but the second parameter is not read in the php as being there. How can I send both parameters?

Well after I posted my question, I thought of something....the & wasn't being interpreted as a &, so I changed the Link to be:
<Link id="pdfLink" xmlns="sap.m" text="Create PDF" href="https://.../scripts/pdf/index.php?yr={/yr}&qtr={/qtr}" target="_blank"></Link>
(I changed the & to be &) This change worked!

Related

TFS Work Item HyperLink from TextBox

Im trying to create a hyperlink on my form that has the URL specified in another field.
I found the Link control which can almost do this, but i dont see a way to configure it use the URL specified in another field.
Something like this might work, but i would have a double https:// in the url.
Is there a way to take a substring of the value so that i can remove the https part ?
Or is there another way to add a link to the work item form that uses the URL from another field.
<Link UrlRoot="https://" UrlPath="{0}">
<Param Index="0" Value="Custom.UrlField" Type="Original"/>
</Link>
Using the HTML field would in theory also be an option, but only if we can hide the HTML buttons and use a small height, this way the URL pasted in this field will become a clickable URL.
No, that's not supported. See Provide help text, hyperlinks, or web content on a work item form
You have to specify the URL directly like this:
<Link UrlRoot="http://www.live.com"></Link>
The syntax to specify a hyperlink with parameters should be like this (See Link and Param XML elements reference):
<Link UrlRoot="http://serverName" UrlPath="sites/{0}/render.aspx?wit=bug&topic=Iteration">
<Param Index="0" Value="System.Project" />
</Link>
That means you need to provide the "http://serverName", only specify "https://" is not working, reference below screenshot.
In your scenario, we can not get the value of another field to set the hyperlink in work item form. There's a Copy Rule for fileds, but it's not available for work item form.
COPY Copies a specified value to a field when a user creates or modifies a work item. See Add a rule to a work item type

How to include another XHTML in XHTML with path info in URL

I will post some pictures to clarify my problem.... i WOULD post pictures but i am not allowed to -.-
If i use a url like
localhost:8080/SupervoteWeb/polls
everything works fine. The header is displayed correctly.
But for some sites i need the url for passing ids or other attributes.
I have checked if it is because of this parameter passing. This is not the case.
An URL like:
localhost:8080/SupervoteWeb/polls[/ enter anything here]
always leads to an error where the header is not displayed correctly.
This is the code of the header. It is placed on every site.
<ui:insert>
<ui:include src="/protected/header.xhtml" />
</ui:insert
By the way: I am using prettyfaces for clean urlmappings.
Can you tell me where this weird behaviour comes from?
If there is any code missing you may need i will post it.
The problem is solved!
The .css was not found - I had relative links to my css files.

Html.Raw not decoding

Just a query, I have used #Html.Raw(Item.sometext) before and it decodes the html tags correctly, I'm getting some data from remore source which is in json format, but when displayed on the page I found Html.raw did not decodes html tags.
To fix the problem I used:
#Html.Raw(HttpUtility.HtmlDecode(Item.sometext))
So my question is, can anyone please tell me why that could be the case, as I'm curious as to the reason. Im using mvc4 and asp.net 4.5
Thanks
George
Here is my answer in an attempt to explain better what I mean (in the comments).
Your JSON is formatted for example (which you have supplied) like so:
<p><b>Location. <\/b> <br \/>...
However, this is not valid HTML. Notice the escape characters used for the slashes '/'. So if you pass this value to Html.Raw it will (should) output it, but it's not valid HTML so will unlikely display correctly (if it display anything at all).
This escape character issue can be fixed using Html.Decode which will effectively return the following:
<p><b>Location. </b> <br />...
This is valid HTML, and can therefore be passed to Html.Raw without any problems
NOTE: Html.Raw does not do any encoding/decoding, in fact it explicitly instructs that the supplied value should not be encoded as it is already raw HTML. This is confirmed here:
Use the Raw method when the specified text represents an actual HTML
fragment that should not be encoded and that you want to render as
markup to the HTTP response.

French characters are not displaying correctly inside javascript grid

We have translated one of our pages to french and all the html within the page displays flawlessly. That said, there is a javascript table (ext js) and the accented characters are not displaying correctly. The page is encoded UTF-8 in the HTML meta tags, but when I look inside FireBug, I see the following:
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
I'm guessing the problem is related to the ISO-8859-1 having worked its way back in. Does anyone know why the page itself would display fine, but the text inside the javascript component wouldn't? Do you somehow specify the encoding separately for the javascript files?
The Accept-Charset tag gives a set of encodings that are accepted -- if all the data sent is encoded UTF-8, then don't worry about it.
Can you elaborate on exactly what is happening?
You say "javascript table" -- I presume you are constructing an HTML table in JS and placing it in the DOM? Please elaborate, especially w.r.t. any character conversions. Are you building HTML text or building with DOM elements with attributes?
Where does the JS get its data? If with AJAX, have you verified the Encoding for that page?
Does the JS use encode() or decode()? Those don't handle UTF-8 correctly.
EDIT:
Type the URL to the JS code in your browser, and look at "Page Info" to see its encoding. I'll bet it is ISO-8859-1, which would explain the header problems.
Next, check the encoding of the AJAX data. If it's dynamically created you can:
Enable "Show XMLHttpRequests" in FireBug's console,
Load on your base HTML page,
Open the FireBug console tab,
Expand the AJAX GET/POST request and open the Response sub-tab,
Check the Encoding for the data, and fix as needed.
BTW, I'm having similar problems and haven't entirely ironed out the issues (still not sure the source data isn't badly encoded).
It's possible that the ext. JS file strips out unrecognised characters as a security precaution.
The "Accept-Charset" header can be specified in a number of places, including as an attribute in certain HTML elements. Have you performed a search for Accept-Charset (case insensitive) in the offending file?

ASP.NET MVC 2 parameters throws JS error

My application works fine when I have only one parameter.
e.g.
/Product/Index/2
/Report/Sales/08-2009
But it failes when I add one more part to the url. Let's say I want to add the end month-year parameter to the url routing. Mow it becomes:
/Report/Sales/05-2009/09-2009
I do get both parameters in my action method. I parse it and retrieve the data and pass the Model to the View. With this scenario it throws the client side JS error when I try to access any of the form elements. I get "object expected" error. The same view works fine using just first parameter. What could be the issues here?
I also loose the CSS styles when this error occurs.
Thanks
well, without seeing any code at all this is difficult to troubleshoot, but I'd say it's likely because you are referencing your javascript and css files using a relative path like:
../content/scripts/myjavascript.js
Adding the second url parameter has caused the browser to be unable to find the urls because you have added what looks like an extra level of depth to the url.
You should provide absolute urls to your scripts and css files. An easy way to do this is to use the "ResolveUrl" method like so:
<%= ResolveUrl("~/Content/Scripts/myjavascript.css") %>

Resources