如何在我的文本框中缓存用户信息,以便用户在用户回到同一表单页面时填写一次信息, [英] How do I cache user information in my text-box so users fill there information once, when a user comes back to the same form page,

查看:161
本文介绍了如何在我的文本框中缓存用户信息,以便用户在用户回到同一表单页面时填写一次信息,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好;

我如何在我的文本框中缓存用户信息,以便用户填写一次信息,当用户回到同一个表单页面时,之前的数据会在那里,所以他不必再填写它们。



这是我的表格代码:





if(Main.checkoutinfo ['Last Name'] .status =='t'){

b + ='

';

b + ='';

b + ='< input type =textplaceholder =class =field -textid =buyerlastname2value ='+ Main.NullToEmpty(Shopping.Cart.buyer.lastname2)+'onkeyup =Shopping.UserUpdate(this,\'lastname2 \'); Checkout.BrainFieldUpdate(此,\'lastname2\');; autocomplete =on/>';

b + ='

';

}



我尝试了什么:



i尝试使用自动完成代码,但我还没有尝试过除

解决方案

您没有指定用户返回页面的路线。是在同一天有一个后退按钮还是一个月后?



如果丢失,您只能确保数据在服务器端存储时仍然存在(我不喜欢cookie或Flash cookie,并且不保证那些,无论如何)。然后,如果您有识别用户的方法,则可以在请求页面时检索其数据。



由于您不能保证用户将从任何给定页面执行的操作(例如他们如何离开),您需要在输入后立即存储数据。请参阅AJAX以获得此类功能。 AJAX也是另一种请求数据的方法 - 但你仍然需要将它存储在页面之间的某个地方。


你好,

你可以添加客户端饼干。所以在cookie中设置值

hello;
how do i cache user information in my text-box so users fill there information once, when a user comes back to the same form page, the previous data would be there so he don't have to fill them in again.

this is my form code:


if(Main.checkoutinfo['Last Name'].status == 't'){
b += '

';
b += ' :';
b += '<input type="text" placeholder="" class="field-text" id="buyerlastname2" value="' + Main.NullToEmpty(Shopping.Cart.buyer.lastname2) + '" onkeyup="Shopping.UserUpdate(this,\'lastname2\');Checkout.BrainFieldUpdate(this,\'lastname2\');;" autocomplete="on" />';
b += '

';
}

What I have tried:

i have tried using an autocomplete code, but i haven't tried anything other than that as

解决方案

You didn't specify the route which the user will take to get back to the page. Was it the same day with a back-button or a month later?

With that missing, you can only ensure the data will persist if you store it server-side (I don't like cookies or flash cookies and there's no guarantee with those, anyway). Then, if you have a means of recognizing the user you can retrieve their data when the page is requested.

Since you can't guarantee what a user will do from any given page (such as how they leave it) you need to store the data as soon as its entered. See AJAX for that kind of capability. AJAX is also another means to request the data - but you still need to store it somewhere between trips to the page.


Hello,
you can add client side cookies. So set value in cookie


这篇关于如何在我的文本框中缓存用户信息,以便用户在用户回到同一表单页面时填写一次信息,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆