Android Question HTTP Post Result

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Guys

Can someone tell me what is the proper way of loading a webpage (into a webview) returned as a result of successful HTTPPost ( I am hoping that I can use the same exact code with B4i)

Here is what I have done so far, but it's not working properly

B4X:
Public Sub WebViewInvokeWithCredentials_JobDone( Job As HttpJob )
   
Try   
    If Job.Success = True Then
        WVHints.LoadHtml( Job.GetString )
    End If
Catch
   
End Try
       
End Sub

Thanks in advance
 

iCAB

Well-Known Member
Licensed User
Longtime User
1. Remove the Try / Catch block. It will hide errors.

2. The sub name should be JobDone.

There is no issue with the sub being executed and no exception is generated. The only issue is that the page doesn't look as expected. In particular, 2 calendar controls get messed up. I believe that .GetString possibly stripping out some formatting characters (but I am not sure if this is the case)

Thank you for your help
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is no issue with the sub being executed and no exception is generated.
It is always important to post all the relevant information when you post a question.

My guess is that you are missing one or more CSS files.
However it is hard to say without seeing the value of Job.GetString.
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
It is always important to post all the relevant information when you post a question.

Hi Erel, thanks again for your reply

Ok then, let me approach this differently

I am trying to use POST (instead of GET) to validate and log a user to some back end system and allow the user to interact with the system from within a Webview.

Using Get, all what I have to do is this:
WebView1.LoadUrl( UrL?Email=SomeEmailAddress&Password=SomePassword )

I am trying to achieve the exact same result with POST. What would be the equivalent syntax using POST?
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
WebView.LoadURL will always send a GET request. It is exactly like entering a URL in the browser.

Can you post the output of Log(Job.GetString)?

I don't think the issue is related to GetString, most likely related to the return output.

Thanks for your help
 
Upvote 0
Top