is it possible to send an action request to a mobile phone? - android

So I have an AWS EC2 instance.
When ROUTE_1 receives a request from a mobile phone, I want the RESPONSE to the mobile phone to achieve three things in sequence.
Open the camera, wait for the user to take a photo
Ask the user to enter one input field
On submit send input data and photos to ROUTE_2 specified in RESPONSE
The Question is:
Is it possible to send 'action-requests' like this?
or
would it be easier to send them to a webpage with the above-mentioned functionality?

Yes, it's called a form element silly :P
Route_1 returns a form element for the user to fill out and submit to route_2
Example:
<form id="mf" action="https://example.com/route_1" method="POST" enctype="multipart/form-data">
<input placeholder="thing to enter" type="text" name="thing1" required />
<label id=image1_lab for="image1">Take selfie
<input type="file" style="display:none" id="image1" name="image1" accept="image/*" capture="user"
required>
</label>
<button id="submit">
<span> submit</span>
</button>
</form>

Related

Responsive HTML - How to show a `Go` button instead of `Next` on mobile keyboard

Ive a simple problem, Ive a form that submits on enter on any field. However, on a mobile input type=text for example doesnt show a Go or submit key on the keyboard.
Instead it shows or does a next and takes the user to next input field. Only the last field shows the Go key.
Is there a way to get this working?
Here is the html:
<form action="" method="POST">
<input type="text" id="field_1" name="field_1" value="" />
<input type="text" id="field_2" name="field_2" value="" />
<input type="text" id="field_3" name="field_3" value="" />
</form>
Thanks a lot

Android: send data to website and receive reply

I am working on an lotery app. The hit is to send the coupon number to the lotery server and receive the result (winner price or not). The web ( http://www.telekino.com.ar/ ) has a simple form with three values: emision,cupon,algo
This is the form:
After fill the form, the web reply the results
I am lost, what is the best way to duplicate this? . Send the form and receive the results.
Suggestion? tutorials?
Form
orm action="/cupones/controlar" id="control_frm" method="post" accept-charset="utf-8"><div style="display:none;"><input type="hidden" name="_method" value="POST" /></div> <label for="sorteo">Sorteo</label>
<select name="data[Cupon][emision]" id="sorteo" class="basic-tooltip"><label for="carton">Número de Cartón</label>
<input name="data[Cupon][cupon]" type="text" id="carton" value="número" title="Ingrese el número SIN puntos." class="basic-tooltip" /> <label for="algoritmo">Algoritmo</label>
<input name="data[Cupon][algo]" type="text" id="algoritmo" value="últimos 2 números" maxlength="2" /> <img id="algorithm-help" src="/img/algoritmo.png" alt="últimos 2 números" width="135" />
<button type="submit" id="control_button">Controlá tu cartón</button>
</form>
I think you should use Asp.Net Web API for server-side if you prefer Asp.Net (C#, VB.Net)
The easiest and probably best way used in android to communicate with web service is by using Volley Library and PHP, MySql web service
See this tutorial

input type="file" accept="image/*" capture="camera" not working for mobile

I've got a simple form that uploads some basic info and an image to my formtools database. It works perfectly on desktop but not on mobile. On my Android phone when I test it it asks me to select the camera or file browser I have tried both camera and file browser and I take a picure / upload an image which it seems to do then loads the thank you page, but when I go the the form tools database the image has not been uploaded.
Anyone know why this isn't working?
here's the form
<form enctype="multipart/form-data" id="competitionform" class="uniForm cmxform" name="competitionform" method="post" action="/formtools/process.php">
<input type="hidden" name="form_tools_form_id" value="110" />
<header>
<h2>Upload your image</h2>
</header>
<label>Your Name </label>
<input width="100px;" type="text" placeholder=" " name="name" />
<label>Your Email </label>
<input type="text" placeholder=" " name="email" /> <
<label for="file">Upload Selfie</label>
<input type="file" name="uploadselfie"/>
<input type="submit" id="submit" value="Upload Selfie" />
</form>
I've also tried adding
accept="image/*" capture="camera"
to the input which opens the camera lets you take a picture then loads the thank you page but again no image is uploaded to the formtools database.
Thanks
<form> with enctype="multipart/form-data" can only upload pic/files and so on .It can't send other input which type is text to the database.
This point, you must set two forms, one for input type=text, another for input type=file.

Where is the inner implementation of "form submit" in webkit of Android

In a browser, if I want to submit a form containing a username and a password input, I only need to add an "action" attribute and set the "method" attribute to "post":
<form method="post" name="form" action="https://www.xxx">
<input id="username" type="text" value="xxxxxx" name="username">
<input id="password" type="password" autocomplete="off" name="password">
<input type="submit" value="submit" >
</form>
then the browser will handle the post and concatenate the password and username as the request and send to the server.
My question is: in the webkit (what I concern is the Android webkit, but I think others will be ok),where is the code of handling such process? Can I find the code that get the text from the input element, concatenate them, and then send to the server?
Thanks
where there's no answer, I finally find it.
For webkit, there's mainly four directory we need to consider in android:
for java part:
framework/base/core/java/androud/webkit
for native c part
external/webkit/Source/WebCore
external/webkit/Source/WebKit
external/webkit/Source/JavaScriptCore
for the form submit, the java part webkit will send a key event which will be handled by C WebCore.
we can see the code from
WebCore/html/HTMLFormElement.cpp
WebCore/loader/FormSubmission.cpp
WebCore/loader/FrameLoader.cpp

have form act as a simple redirect (HTML/PhoneGap)

I'm making a prototype and the manipulation of the url when submitting a form is causing me issues. I just want to redirect to the link but keep my styling.
<form method = "link" action="portal.html" class="forms">
<label>Username:</label>
<input type="text" name="username" />
<label>Password:</label>
<input type="password" name="password" />
<input type="submit" class="submit" />
</form>
I want the submit to act a a straight redirect.. w/ appending the ?username=&password= to the redirect.
If it makes a difference this is an html5 project for android using phonegap.
If I understood correctly, you just want to submit the form and go to another page, while appending the form's fields to the URL as a query string (?foo=bar&foo=bar). For that you have to declare your form's method as GET, like so:
<form method="GET" action="portal.html" class="forms">
EDIT: turns out the desired behavior is exactly the opposite.
To don't append a query string, you could set your form's method to POST
<form method="POST" action="portal.html" class="forms">

Categories

Resources