This plugin offers the ability to auto fill form.
If the first parameter is an URL, the plugin will fetch the returned JSON object via AJAX. Or you can pass a pre-fetched JSON object so that no AJAX will be performed.
The second parameter is an object containing other options.
type - AJAX request type
data - Data to be sent to the server
errorTrigger - if the JSON object contains this as its key, error callback will be triggered. Useful if server side returns a custom error message
mSelectCheckName - Default to false.
True: look for multiple select boxes with their name.
False: look for multiple select boxes with their ID
ajaxError - callback function for AJAX error
error - error callback if the JSON object is empty, or contains errorTrigger as its key
beforeFillForm - callback function to be executed before start filling the form
beforeFill - callback function to be executed BEFORE filling a form element
afterFill - callback function to be executed AFTER filling a form element
complete - callback function to be executed when all form elements have been filled
Basi Example with pre-fetched data
var data = { username: 'peter', gender: 'M' };
$('form').autoFill(data);
Full Example using AJAX:
$('form').autoFill('get_data.php',
{
type: 'GET', // AJAX request method
data: { record_id: 2 }, // Request parameters
// if the JSON object contains this key,
// error callback will be triggered.
// Useful if server side returns a custom error message
errorTrigger: 'error',
// Default to false.
// True: look for multiple select boxes with their name
// False: look for multiple select boxes with their ID
mSelectCheckName: false,
ajaxError: function(error, form)
{
// do something if AJAX error occurs
alert(error);
$(form).hide();
},
error: function(form)
{
// do something if error occurs
alert('Unable to fill form!');
$(form).hide();
},
beforeFillForm: function(form)
{
// do something before start filling the form
$(form).show();
},
beforeFill: function(key, value, form)
{
// do something BEFORE filling an element
if(key == 'password')
return false; // return false to skip current form element
if(key == 'gender' && value == 'female')
alert("OH! She's a lady!");
},
afterFill: function(key, value, form)
{
// do something AFTER filling an element
if(value == 'blah')
confirm('What are you talking about?');
if(key == 'zip' && value == '')
return false; // return false to skip all pending form elements
},
complete: function(processed, form)
{
// do something when all elements have been filled
alert(processed + ' elements have been filled!');
}
});
文/arjinmc 本文是基于官方demo来分析Autofill Framework的用法(要正常打开这个项目请使用Android Studio Preview 3.0以上版本,并下载Anroid O模拟器镜像)。Autofill Framework最低支持SDK API 26(Android O)+。 在手机中管理autofill服务: 设置->系统->语言与输入->高级->自动填写服务->选择
本文是基于官方demo来分析Autofill Framework的用法(要正常打开这个项目请使用Android Studio Preview 3.0以上版本,并下载Anroid O模拟器镜像)。Autofill Framework最低支持SDK API 26(Android O)+。 在手机中管理autofill服务: 设置->系统->语言与输入->高级->自动填写服务->选择自己想要的服务,点击
输入框在chrome浏览器下显示白色背景,主要针对type为password的input,即使添加了非白色背景,仍然没用,看控制面板会有自动填充:input:-webkit-autofill的 background-color: rgb(250, 255, 189)!important;这个样式 尝试把自动填充关闭:autocomplete="off",仍然没有用。 解决如下: 1、设置box-
我将手机从8.0更新到8.1,现在当我尝试在我的应用程序(使用API级别25构建)上点击任何EditText或com.rengwuxian.materialedittext.MaterialEditText时,我遇到了这个崩溃. FATAL EXCEPTION: main java.lang.NullPointerException: activityToken at android.os.P