phone number formatting in client side while entering number in flex - apache-flex

in my flex application i want to keep a format like...
i want to show space in client side while entering phone numbers..
After entering three numbers cursor should leave a space...
for eg:- 111 111111
is there any idea to work this in CLIENT SIDE itself

You can use Masked TextInput component. More info is here.

You should be able to work something out using the mx:PhoneFormatter (which can be customized to match whatever pattern you'd like): http://livedocs.adobe.com/flex/3/html/help.html?content=formatters_2.html
<mx:PhoneFormatter formatString="### ######" />
Perhaps replace the contents of the input field with the PhoneFormatted version onKeyUp.

Related

input of an arbitrary number by the user without long waiting for the extension

Please tell me how to choose a template for the user to enter any number. Perhaps the only option is to show Asterisk the end of the set with a grid.
.#!
X! is one digit template(X=[0-9]) without search for more input ("!")
There is no patern for #. It just end input in some apps, see app documentation.

How to manage(represent/control) emoji in Xamarin.Form?

I want to handle emoji for 3 points.
1- Represent Emoji: I have functionality where user enter in Entry(textbox) and I show it in Label. Currently I use Label control to display text. I want to show Emoji selected by user in Label. If I try to show that emoji in label, it shows ??. Do I need to set any property to represent symbol or I need to change control? If I need to change control, which control I should use.
2- Pass Emoji in API: I want to save user entered text. Currently I only save text to database using API. I want to save emoji but I don't know how to get encoded character of emoji. Please note that I will get saved text from API to display in label. So, I must be able to get it from API and represent it.
Please suggest. Thank you
1- Represent Emoji
This is an easy task - you don't have to do anything special as you can just do:
<Label x:Name="lbl" Text="{Binding Source={x:Reference Name=ent}, Path=Text" />
<Entry x:Name="ent" />
or
lb.Text = ent.Text;
emoji should appear correctly in the Label.
2- Pass Emoji in API
This can be tricky, it may break JSON deserialization and etc. But it all depends on your setup. Try to send it to the API and try to retrieve it back. If there will be some problems check the next threads to get a better idea:
how can I Deserialize emoji in json in C#
How do I remove emoji characters from a string?
and etc.

Prevent ? from moving to query parameters

I'm working on some interesting APIs that have a "?" in their path, like so:
/api/?other/stuff/here
However, if I type "?" in the request URL in Paw, it automatically moves my cursor into the query parameter fields. Is there a way to disable this? I'm forced to use postman at the moment to work around this, which is less than ideal.
Nevermind, using %3F instead fixed the issue
As mentioned before, using %3F should work nicely!
Another, more generic way is to use the URL-Encode dynamic value:
Right-click on the field where you want to insert the special character and pick Encoding > URL-Encoding > Encode
A popup opens and you can type your special character (here ?) in the Input field. You should see the preview of the encoded value at the bottom of the popup.
Continue to type the end of the URL after this dynamic value. And you should be good to go!

only two digits allowed after decimal asp.net

I have a textbox where the user must not be able to enter more than two digits after a decimal.How do I do this without using javascript?
Thanks.
You can set the MaxLength property of the textbox, but that doesn't have any notion of whether or where the decimal point is.
You could also use a CustomValidator and check the inputted number on the server via the ServerValidate event. But this will require going to the server to check the value (i.e. it will initially look like your form allows users to input invalid numbers).
You should also be able use to a RegularExpressionValidator, depending on your exact globalization requirements, which will use JavaScript on the client to provide immediate feedback:
<asp:TextBox ID="NumberTextBox" runat="server" />
<asp:RegularExpressionValidator runat="server" ControlToValidate="NumberTextBox"
ValidationExpression="\d+(?:(?:\.|,)\d{1,2})?" />
If you want the immediate feedback to the user, you'll need to use a JavaScript based solution.
You cannot cause the textbox to stop accepting text after two decimal places without directly or indirectly using javascript. (This is sometimes called an input mask).
You can, however, allow the user to enter free-form text and validate the text upon postback on the server. You can either automatically round the number for them, or return an error message to the client.
If you really need to prevent the user from entering more than two digits after the decimal point, you'll need to use JavaScript or a server control that implements the JavaScript for you.
However, may make more sense to allow them to enter any number of digits and then catch it on validation (or just round to two digits).

How to extract element id attribute values from HTML

I am trying to work out the overhead of the ASP.NET auto-naming of server controls. I have a page which contains 7,000 lines of HTML rendered from hundreds of nested ASP.NET controls, many of which have id / name attributes that are hundreds of characters in length.
What I would ideally like is something that would extract every HTML attribute value that begins with "ctl00" into a list. The regex Find function in Notepad++ would be perfect, if only I knew what the regex should be?
As an example, if the HTML is:
<input name="ctl00$Header$Search$Keywords" type="text" maxlength="50" class="search" />
I would like the output to be something like:
name="ctl00$Header$Search$Keywords"
A more advanced search might include the element name as well (e.g. control type):
input|name="ctl00$Header$Search$Keywords"
In order to cope with both Id and Name attributes I will simply rerun the search looking for Id instead of Name (i.e. I don't need something that will search for both at the same time).
The final output will be an excel report that lists the number of server controls on the page, and the length of the name of each, possibly sorted by control type.
Quick and dirty:
Search for
\w+\s*=\s*"ctl00[^"]*"
This will match any text that looks like an attribute, e.g. name="ctl00test" or attr = "ctl00longer text". It will not check whether this really occurs within an HTML tag - that's a little more difficult to do and perhaps unnecessary? It will also not check for escaped quotes within the tag's name. As usual with regexes, the complexity required depends on what exactly you want to match and what your input looks like...
"7000"? "Hundreds"? Dear god.
Since you're just looking at source in a text editor, try this... /(id|name)="ct[^"]*"/
Answering my own question, the easiest way to do this is to use BeautifulSoup, the 'dirty HTML' Python parser whose tagline is:
"You didn't write that awful page. You're just trying to get some data out of it. Right now, you don't really care what HTML is supposed to look like. Neither does this parser."
It works, and it's available from here - http://crummy.com/software/BeautifulSoup
I suggest xpath, as in this question

Resources