Mapping Service to Appery.io HTML Component and Variables - appery.io

Is there a way to take a service that connects to an Appery database and map it to an HTML page component or a variable?
I have successfully set up a service that connects to my Appery.io database and I'm mapping it to a page.
I can get content into Text and Image components, but mapping a string to the HTML component doesn't seem to work, nor does mapping a string to a variable set up on that page (typed as a string). I tried mapping the $[i] object to the HTML object as well, but that didn't seem to change anything.
I tried mapping a couple different columns to the variable and the HTML component and even the ones that successfully map to other components don't result in any content showing on the page. As a way of trying to see what was going on, I used the "log value to console" transformation and nothing shows up in the console for the variable or HTML component.

The basic mapping won't work for that purpose, so please use the following workaround:
Please add two custom includes (SafeHtml and DomSanitizer) and define variables, based on them:
On the HTML component add the property [innerHtml]:
[innerHtml]=value
Set the value to that variable with the custom code:
this.value = this.sanitizer.bypassSecurityTrustHtml('appery.io');

Related

Blazor component referencing attribute value directly from another attribute

I have an external blazor component with 2 attributes like below. I am resolving through a function by passing the value of Href attribute.
<ComponentLink Href="bookings" Active=#GetCurrentLink("bookings")>
1my question is there any way to reference or bind the value of attribute value directly from another attribute without passing through a variable.
Basically something like
<ComponentLink Href="bookings" Active=#GetCurrentLink(#Href)>
I am asking this because it is within link list for a navigation and i dont want to create a fiel or property for each Href element. I can fix it on the ComponentLink source code possibly but I don't have source code access as it is in nuget package.
I have tried using #ref but It also doesnt help as intented.
There is no easy way to achieve this.
You can look at the component definition in the same way as the class constructors. You will have the same problem when you want to pass the same value there.
The best option, in this case, is to extract the text in the variable and reuse it.
You can also define your links in your C# code as an array and just enumerate the links to render the ComponentLink components dynamically.
Here is an example of this approach: https://blazorrepl.telerik.com/wmFYwAvG39LqBZFb06
The option with the #ref is not working, because the #ref value is populated once the component is rendered and typically, you will need to evaluate the Active value before that.

Multiple Alias Routes to base Razor Page

I'm pretty new to Razor Pages, and I'm trying to figure out how to replicate routing I have in my current Angular Page.
I have a base razor page that will be populated with different data depending on which parameter is passed to it. This is easy enough, and I know how to do this. However, my problem is in the routing because I want to be able to pass a readable parameter that is based off of the base URL. For example, I want to be able to do:
https://myURL/Band1
https://myURL/Band2
and have both point to the same page (but not the Index Page), consume the parameter "Band1" or "Band2" to display the associated information.
I understand how to consume the parameter, and how to get data, what I'm not clear on is how to do this routing based on the base URL. I can see how I'd do it if it were https://myURL/b/Band1 since I'd make a "b" page and accept parameters.
But how does one do this without that intervening segment of the URL? I need to be able to do this to not break existing links.
Thanks!
The docs for Razor Pages suggest you can create a page named Index.cshtml, which will act as the default where no page is specified in the URL.
Edit
If you want to preserve the parameterless index page, but have your page take its place when the additional URL part is provided, try the following in your page:
#page "/{bandName}"

phpDoc for object's properties

I've got file template.php, that is included in CBitrixComponentTemplate's method.
CBitrixComponentTemplate has property $this->__component, that is dynamicly filled with object EtmOrderAdd. EtmOrderAdd has property objValidator.
Now, when I am writing the file template.php, I need all these properties to be understood by phpDoc.
Here's the picture, illustrating my idea :
How should I write it?
Bitrix has almost no phpDoc for internal methods and functions. Also it has a plenty of legacy code, that won't show correctly with PhpStorm's code completion.
However, there are several things you can try to improve the situation:
Add bxApiDocs files as an External Library to PhpStorm.
This will add autocomplete for the internal bitrix methods
It seems like you've defined custom component class since $template->__component usually contains CBitrixComponent object that doesn't have objValidator property. So you need to add #property inside your class.php file of your component.

Jsp - Assigning java variable with html input type text in same jsp page

I am trying to access one tag in index.jsp page to fetch it's value and access the input tag html value to one java variable value in the same jsp page (index.jsp)
I am trying to use the variable to connect to database and fetch other details in the same jsp page but that html input tag value is not assigned to java variable using request object and tried in many ways but was unable to assign the value...
is there any method/idea to assign the html input tag=text value to java variable in same jsp page without using JSLT?
Appreciate your response
I've decided to answer this because I've seen many green programmers get confused about this same exact subject for many HTML preprocessing languages (JSP in this case). I'm going to start off right away saying this is an XY problem, please see https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem .
After reading about what an XY problem is, the actual problem here ("X"), is that you can't access HTML elements at time of user interaction with JSP. JSP generates the HTML on the server. The HTML is then sent to the Client, the JSP code is done, and no longer able to do anything with the page because it isn't on the server. Now the HTML is on the client side and a user would enter the value you want. The server really has no access to the page anymore and it is impossible for the JSP code that generated the page to access the value.
Essentially, it is not possible to access an HTML element with JSP without doing this another very different way (sending value by ajax or something).

How can I get access to the request url from a ServiceStack.Razor layout template?

I have defined a layout template .cshtml for my site using the following method:
#{ Layout = "InsideLayout"; }
I am now trying to grab the request url to figure out what navigation menu item should be marked as active at any point in time. It however looks like the Request object is null (however unable to get a break point in the view, so not 100% that's the issue, but pretty sure).
To me, it seems that the current Request object should be populated properly in a Layout view, so it can some context sensitive markup in it, but as is this doesn't seem possible. Is there a specific class that the layout must inherit from to enable this, or is what I'm seeing the expected behavior?
Another option I was thinking might work, is to create a custom service to back the layout view. I tried this, however I wasn't able to get the service code to execute when a page using the layout was loaded. Is this even possible?
Normally you should have access to the Request inside the view. But a better way to do that is to pass it in the model. Simply add the information as a property to the model that you are passing to this view and have the service populate it.