Hello Andrea,
The problem with CORS is not to place the right header in the client side, but in the server side. So it's the server who must set the appropriate CORS permissions. You can find more information at this web page, which explain how to set the CORS permissions in various servers. If you can't handle this using your server's, but, your server can run PHP scripts (for example), then you can try to set the CORS permissions from a PHP script, so you can call to that script, who can also make the appropriate reading of the URL that you wanted, something similar like below:
Hello Andrea,
I am not sure... probably it's not solve the error, but, look at your "nscameraUsageDescription"... maybe it's case sensitive and you must use "NSCameraUsageDescription". On the other hand, iOS 12... sounds old to me... and may you are right and that problem is related with that version of iOS.
Hello Andrea,
The point is that the error that you shown is procuded in the compiled Swift code: we commonly no need to edit nor modify that code, but the Javascript code of our apps.
Apparently you solve the problem, however, maybe with "Capture=True" you can get the things worked as expected, but, if you add the below XML in the Config XML option of the app:
Basically, when we need to use the Camera or the Library, we need to establish certain strings in order to properly use that resources at iOS. So you can try with that XML, or, just leave the Capture = False, if you solve with this and you no need to go ahead.
Hello Andrea,
You must lost the fear to use an HTTP client control: in fact when you set an URL to the Report, internally an HTTP call is made, so, using an HTTP call to retrieve the data is just a simple step. If you use an HTTP client control you can work with the response before assign it to the "Report.Data" variable.
Suppose the report's source (which will be assigned to the Report's Data variable) contains properties like this: "date_created": "2022-03-15 13:00". You can use an HTTP client control to get the source, and, in the HTTP client control Success event, you can write a code like below:
Doing that you can use a code like below in the Report HTML:
Hello Andrea,
There are various ways to do it. I prefer to do these things in the server side, so, our records can have a property like "IsToday", so we can simply prepare a code like below:
If you prefer to rely on the client side, you can prepare a variable in the Show event of the view in wich you place your Report control, a variable like below:
Doing that you prepare a code inside the Report like below:
Of course, we suppose that "Record.MyDate" contains date values like "YYYY-MM-DD". If there is other formatted date string in "Record.MyDate", then you must change the "TodayFormatted " variable accordingly.
Hello Andrea,
You can use the "ng-show" directive in a way like below:
Hello Paolo,
Glad to know that you got it. Anyway, take a look at the documentation of the InAppBrowser plugin. In particular to the available events, and, more in particular, to the "message" event. I did not test it (like I test the above code) but I think the "message" event can be a good thing to be considered.
Hello Paolo,
I am not sure if what you wanted is what is shown in this stackoverflow answer. I use that answer's code with good result in one of my apps. The idea is simple, we call to app.cordova.inAppBrowser.open and save a reference to the opened window, that is:
Therefore, inside "your-page.php", you can place a button and a "click" event listener for that button. In the "click" event listener the only thing that you must do is to set the variable "window.shouldClose" to true. So when the user click on that button the the code after "if(values[0])" will be executed: you can then close the "InAppBrowser" window and/or do anything else.
Hello Paolo,
But is there a solution with listening events? of the type I create a button on the web page with an id or class, which when pressed closes the InAppBrowser, and at that point a button appears in the app to send the confirmation via whatsapp
I am not sure if can understand. If you open an URL in the system browser, yes, there is a way to make some kind of communication between the opened URL and the app. However, what I did not understand is that, if I am not wrong, you don't want to open an URL, but, a "special" URL with the "whatsapp:" scheme, which apparently have his own behaviour (open the Whastapp app). So I am not sure if can understand what you mean by "listening events".
If what you are thinking is to open a certain URL (a file, for example, "my-file.php") who receives the right arguments indicating the user's phone, the order details, etc., and then, in that "my-file.php" place a couple of buttons, one to open the Whatsapp, and another to close the opened window, then yes, it's possible to do something, that is, it's possible to place a button in "my-file.php" to close the opened window. But again, I am not sure if this is what you wanted or not.
On the other hand, if when you open the "whastapp:" URL in the system browser, then the system browser automatically opened Whatsapp... why you need to go ahead? I mean... if I am not wrong, what the user see is the Whatsapp app opened, and therefore can continue the order... then he can go back to the app if he wanted. Remember that when you opened the system browser your app is not closed, just placed at the background: it's still available for the user if he want to go back to the app.
Hello Paolo,
Maybe you can think in a possible way to avoid the usage of Whatsapp? I mean... apparently you use Whatsapp for some kind of order confirmation, but, this can have various problems: the first one what you already see, you must leave the app in order to use the system browser. This is not a real problem to me, even more, if we can't go it working using the InAppBrowser plugin. But another additional problem can be that the user must have installed the Whastapp app in his phone.
So, maybe you can plan another possible way to confirm the user order? I can think in three possible alternatives at this moment. The first one can be to send an EMail to certain account. You can make an HTTP call to some of your server script with the right information and then send an EMail from the server to a certain EMail address. The second alternative that I can think is the usage of push notifications. Again, you can use an HTTP call to some of your server script in order to send a push notification. Who receives that push notification? Another app... who must be installed by the "manager of the orders".
Lastly maybe the "sms:" URL scheme can be used like described here (I am not tested it). The problem with this can be that probably we can't use the InAppBrowser plugin, in the same way that we can't use it with the "whatsapp:" URL scheme. The advantage can be that the "sms:" realy on the system SMS app, which is available by default, that is, the user no need to install it like in the case of the Whastapp app.
What do you think about it, Paolo? Note that the first two possible alternatives do not require that the user leaves the app at all, since you can do it by using HTTP calls to your server, so, you have the control all the time.
Hello to all,
I post here this because may can be useful for other customers. Finally Mario and me discover (after some mails interchange and tests) that the problem is caused due to feed the "items" of the Select control with numbers and not strings. Apparently in this case the "itemIndex" property is certainly set to "-1" and not contain the expected value, that is, the index of the selected item. The solution, for now, is to feed the Select control's items property with strings and not with numbers. Doing that the "itemIndex" always returns the correct index of the selected item in the Select control.
If what we certainly have is an Array of numbers, we can use the "map" function to feed the Select items property with strings instead of numbers: just take a look at the below code:
By doing that the "itemIndex" property work as expected, since what we really assign to the items property is an array of strings and not an array of numbers.
Hello Paolo,
It's possible to edit the source code of a plugin, however, probably it's not the best that we can do, since that can cause problems in the future, for example, when the plugin publish some updates, so our code can be "outdated" at sometime.
I think the solution here is to use the system browser instead of the InAppBrowser plugin. Certainly, that causes that the user leave the app, but, if that work as expected, probably is the best solution, because then we no need to go ahead, edit the plugin's code, etc. What do you think about it?
Hello Mario,
First of all, we can set the "itemIndex" property of a Select control at designtime. That "itemIndex" is therefore the set one before the Select control "changes". Once you change the selected item, certainly the "Change" event is fired, but, even if you did not use that event, the "itemIndex" property changes accordingly to the new selected item.
I can't reproduce the problem, Mario. I place a Select control in a dialog, then I place a button in the dialog and when press the button, show the "itemIndex" of the Select control in an alert. It's work as expected. If I did not select any new item at runtime, then the designtime set is what I see in the alert. If I change the selected item at runtime, then what I get is the corresponding "itemIndex".
May you can provide to me a sample app in which you can reproduce the problem? Please, feel free to send me the app via Email, so I can take a look. Please, use one or more Comment controls or include some kind of "ReadMe.txt" file in order to tell me what you expected and what you get. Maybe the problem exists and therefore I can do something about, but, trying here what I understand that I must try, I simply can't reproduce the problem.
Hello to all,
This post is just to mention that with the new generation of DecSoft HTML Compiler, now it's possible to deal with SQLite databases using the SQL.js library. Take a look at this release information post.
Hello Mario,
Are we talking about AB1, don't you? If so... I can't reproduce here the problem... Please, be sure that you are using "[Select1.ItemIndex]" and not "[Select1.itemIndex]": note that the "ItemIndex" is case sensitive, so we can't use "itemIndex".
If we are talking about AB2, then certainly the property's name is "itemIndex", but, I can't reproduce the problem. If I place the below code in the Change event of a Select control, what I get is the expected item index:
Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.