Aweber form problems with encoding - utf-8

I have webpage, that use utf-8. But generated aweber webform use iso-8859-1 to send signups.
<form method="post" class="af-form-wrapper"
accept-charset="iso-8859-1" action="http://www.aweber.com/scripts/addlead.pl">
Problems started when I get some signups from foregin countries (e.g. Russia - for example in name field should be "Валера" but in iso-8859-1 I get something like this.
When I changed to accept-charset="UTF-8",
<form method="post" class="af-form-wrapper"
accept-charset="UTF-8" action="http://www.aweber.com/scripts/addlead.pl">
I get something like this "Владимир КлименÐ" .
What I must do, to correct signup those users.

I get answer from aweber support. Currently they don't support UTF-8. They working on it.

Put that code on all of your sites where you have signup forms and it should do the trick (it changes the charset of the document to ISO-8859-1 before sending the data). You need jQuery to make it work:
<script type="text/javascript">
jQuery(".af-form-wrapper").on("submit", function(event){
document.charset = 'ISO-8859-1';
});
</script>

Related

email client, algorithm for guessing email address based on few characters entered

We are writing an email client, and would like to have an algorithm guessing the intended email address based on the characters entered to the address line.
Something like Gmail's guessing based on the beginnings of the words in the address, as well as on frequency of use, or perhaps on when the address was used last. I don't know how they do it, but it works very well.
Is there a good public domain algo?
Or should we just make something up and improve as we go?
it's just a simple jQuery/ajax post with database backend for figuring out the e-mail addresses.
so basically you attach a handler to an input box (i.e., keydown) - query your database, and then 'autofill' for suggestions. i.e., (borrowed from another source online)
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("input").keyup(function(){
var txt = $("input").val();
$.post("demo_ajax_gethint.asp", {suggest: txt}, function(result){
$("span").html(result);
});
});
});
</script>
</head>
<body>
<p>Start typing a name in the input field below:</p>
First name:
<input type="text">
<p>Suggestions: <span></span></p>
</body>
</html>
and of course, then you'd make a file that output results based on what you input (the .asp or .php file).

How to specify encoding in MVC3 Html.Beginform

I have MVC3 view page like below,
#using (Html.BeginForm(null, null, FormMethod.Post, new { #action = "https://www.paymentdummysite.com/abcd" }))
{
#Html.ValidationSummary(true)
#Html.AntiForgeryToken()
<div class="homePageSubSecContnt">
<p>You will be re directed to your banking site.</p>
#Html.Hidden("version",Model.cvsVersion)
#Html.Hidden("bill_method", Model.cvsBillMethod)
#Html.Hidden("shop", Model.ShopCode)
#Html.Hidden("shopmsg", Model.shopmsg)
#Html.Hidden("password", Model.password)
<input type="submit" id="Next" name="Next" value="Next" class="buttonStyle_2" />
</div>
the above code re-directs me to the banking site. Here i have provided absolute url and not calling any controller.I am using 2 html form in this view page, so that i can get model details from the 1st html form GET method of controller.
Now i have to encode the form data(hidden input) and re direct to external url. My encoding format is Shift-JIS which is japanese encoding format. I am not sure, how to do encoding in view page. Can anyone throw light on this?
In C# code i can do encoding as below,
byte[] postDataBytes = System.Text.Encoding.GetEncoding("Shift-JIS").GetBytes(postData);
how to do the same encoding in view page?
<meta charset="Shift-JIS"> Will this work?
I think i have to use charset="Shift-JIS", but how to use it in mvc forms.
After long time i have found answer myself:
Since my code has japanese text and i want encoding format as Shift_jis , even if i specify charset or encoidng format the code is not working perfectly.
The solution is:
Go to file menu in visual studio,
File->advanced save options->Unicode-codepage 1200(3rd option)->Click
Ok.
This will solve your problem.

Radbutton Onclick mozilla bug

When i click a radbutton then postback changing page url as /blabla.aspx?btnMsg_ClientState=&btnCarDetails=Sorgula&btnCarDetails_ClientState=&btnPrice_ClientState=&btnReject_ClientState=# ..
First pop-up work but then break.
There are 5 extra buttons and seems all in page url. Where is coming these query strings ?
Ie Developer tools says:
ScriptResource.axd...
I cant find solution, please help.
It appears that the form on your page is configured to use a GET request when submitted.
<form id="form1" runat="server" method="get">
In this case all parameters on the page are specified as part of the URL, which includes the input elements that are used for rendering the button, as well as the other input elements on your page.
You can change this behavior by setting the method attribute of the form to post, so that a POST request is utilized for submitting the form.
<form id="form1" runat="server" method="post">
In this case the parameters will be passed in the message body of the HTTP request.

How to store to browser auto-complete/auto-fill when using AJAX calls

I've noticed that browsers do not store form values until the form is submitted, which means that if you're using AJAX instead of a standard form submit, your browser's auto-fill is never populated. Is there a way to force populate your browsers auto-fill/auto-complete so that I can have this convenience with forms that are submitted via AJAX? It's annoying to go to my AJAX page and have to type in the same things in the form fields every time because the browser doesn't remember them.
My question is pretty much identical to the this one, except that only a work around in FireFox is provided as the accepted answer to that question. I'm looking for a solution that works in all major browsers (at least Chrome, FF, and IE), if there is one.
Note: I am not talking about AJAX auto-complete plugins, which is what almost always pops up when googling this question. I am talking about your browser's built-in auto-complete or auto-fill that helps you fill out forms by remembering what you entered in the past.
For anyone who's still trying to solve this, seem like I've found the answer.
Chromium tries to recognize the submit event, even if you preventDefault and handle the actual submission yourself.
That's it, you need to preventDefault the submit event, not the click event.
This worked on Chrome, Edge and IE 11 at the time of writing (I'm too lazy to download and test it on Firefox).
Here's your form:
<form method="POST" id="my-form">
<label>Email</label>
<input autocomplete="email" type="email" name="email">
<button type="submit">Subscribe</button>
</form>
Notice the autocomplete attribute. These are all the possible values that you can use for autocomplete.
In JavaScript, simply do this:
$("#my-form").on("submit", function (ev) {
ev.preventDefault();
// Do AJAX stuff here
});
The browser will remember whatever email you've entered on clicking subscribe button.
I have also come across this; there doesn't seem to be a great solution, certainly not a cross browser one, but here is one for IE I haven't seen anyone mention:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<SCRIPT>
function subForm()
{
window.external.AutoCompleteSaveForm(f1);
f1.submit();
}
</script>
</HEAD>
<BODY>
<FORM id=f1>
User ID : <input type=text name=id></input><br>
Password :<input type=password name=pw></input><br>
E-mail :<input type = text VCARD_NAME = "vCard.Email"> <br>
<input type=button value=submit onclick="subForm()">
</FORM>
</BODY>
</HTML>
From: http://support.microsoft.com/kb/329156
Use this Method:
AutoCompleteSaveForm = function(form){
var iframe = document.createElement('iframe');
iframe.name = 'uniqu_asdfaf';
iframe.style.cssText = 'position:absolute; height:1px; top:-100px; left:-100px';
document.body.appendChild(iframe);
var oldTarget = form.target;
var oldAction = form.action;
form.target = 'uniqu_asdfaf';
form.action = '/favicon.ico';
form.submit();
setTimeout(function(){
form.target = oldTarget;
form.action = oldAction;
document.body.removeChild(iframe);
});
}
Tested with ie10, ff latest, chrome latest
Test yourself: http://jsbin.com/abuhICu/1
Have you try the answer of my question that you mention?
The answer is using hidden iframe but seems he claim the idea is not working on IE and Chrome on that time.
Try to take the idea, and instead of using hidden iframe, just put the username/password/submit visible input element in a form POST, in an iframe. So user will enter login details directly into iframe. With proper Javascript you can put loading image, get success or denied from server and update the parent or the whole page. I believe it should work on any browser.
Or if you still want to use AJAX since you probably implemented the API on server side. You can make the iframe to just send a dummy POST at the same time send the real user/pass to AJAX URL.
Or back to use hidden iframe, not to hide it but move it to the invisible area like top: -1000px.
After several hours searching, I found a solution at Trigger autocomplete without submitting a form.
Basically, it uses a hidden iframe in the same page, set the action of your form to the 'src' of the iframe, and add a hidden submit button inside the form, when user clicks your button which triggers AJAX requests, you should programmatically click the hidden button before sending the AJAX request. see example below:
In your form page:
<iframe id="hidden_iframe" name="hidden_iframe" class="hidden" src="/content/blank"></iframe>
<form target="hidden_iframe" method="post" action="/content/blank" class="form-horizontal">
<input type="text" name="name">
<input type="text" name="age">
....
<button id="submit_button" type="submit" class="hidden"></button>
<button id="go_button" type="submit" class="hidden">Go</button>
</form>
Then java script:
$('#go_button').click(function(event){
//submit the form to the hidden iframe
$('#submit_button').click();
//do your business here
$.ajax(function(){
//whatever you want here
}})
);
Hope this helps.

Facebook: Invalid mark up on FBML

I am using the W3C XHTML validator to check my sites and I am getting some errors on pages with FBML. Most of the cause of such errors is the "&" character. Since FBML values and attributes are generated on the fly, I have no way to encode the character properly before displaying it.
Question: Is there a way for me to tell Facebook Connect to render the mark up properly?
Thanks.
Try to put the facebook code in CDATA:
<script type="text/javascript">
/* <![CDATA[ */
document.write('<fb:login-button length="long" size="large" show-faces="true" perms="" onlogin="window.location=\'<?=current_url()?>\'"></fb:login-button>');
/* ]]> */
</script>
In short, not as far as I know. To make matters worse, the fb:* tags don't validate either, even if you make your html tag look like this:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en">
If this is a huge issue for you, you might be able to get away with putting non-XHTML-compliant markup in its own HTML-4.01-strict iframe, to basically sweep the crap under the rug.
This might be helpful:
http://wiki.developers.facebook.com/index.php/Facebook_Platform_for_Mobile:_XHTML
Some german guy also worked on it:
http://translate.google.com/translate?js=y&prev=_t&hl=en&ie=UTF-8&layout=1&eotf=1&u=http%3A%2F%2Fwww.ka-mediendesign.de%2Fblog%2Ffbml-in-xhtml-neue-version%2F&sl=de&tl=en
This is how i am doing it. Wrap around all fbml tags inside and then use js to simply uncomment the fbml code using javascript. Heres an example:
Markup:
<P class="fbreplace" style="display: none;">
<!-- FBML
<fb:like layout="standard" show_faces="false" colorscheme="light"></ fb: like>
->
</ p>
JS (JQuery Required):
$(document).ready(function() {
$(".fbreplace").html.replace(/<!-- FBML /g, "");
$(".fbreplace").html.replace(/ -->/g, "");
$(".fbreplace").style.display = "block";
});

Resources