Conversion of a character to asterisk - character

i had been to an interview for the post of webdeveloper/HTML developer . There he asked me a question, the ques was.... there is a textbox and a button when i enter any character into the textbox it must be converted into a asterisk sign(i.e "*")once the characters are entered now on clicking the button all the signs must be converted back into characters in a pop up.i was unable to answer this question,but i really want to know the solution for this. i think u can use javascript ,html or jquery for this i am not sure about which language is exactly used .plzzzzz suggest me the solution.

Most text boxes have a "password" mode in which you can't see the text that is entered. Just toggle the mode by clicking on the button.

Try using a textbox with a Password option, or a Password input box. Of course it would be easier to give you more specific help if you were more specific about the language and platform you are using.

In Swing you have a JpasswordField for such cases. If you are using Swing then you can use it. When the user clicks in the button just do jpassfld.setEchoChar(0) which will show the original text.
But depends on what GUI toolkit you are using. Above ws an example with Swing

Can you not just use the PasswordChar of the TextBox?
In C#, to set the PasswordChar:
TextBox1.PasswordChar = '*';
To remove the PasswordChar on the button click:
TextBox1.PasswordChar = (char)0;

Depending on the programming language and editor, usually a text box has a property that makes it behave like a password entry field. Simply connect your button to toggle that property.
Sorry for that generic answer, but your question is very vague.

Related

Is there an existing iOS component to type in a UITextView? [duplicate]

In my app I want the user to type names into a UITextField (or equivalent) and then when they press return, it will put that word(s) in a blue bubble that's usually associated with tags. The cursor then moves to the end where they can add more "tags".
This can be seen when adding contacts in the To, CC & BCC fields in the Mail app, and also when selecting contacts in the Messages app.
How is this done? Is it something that's provided in the UIKit or available somewhere else?
Many thanks,
Michael
Venmo just open sourced their token field.
https://github.com/venmo/VENTokenField.git
edited:
The equivalent control in desktop Cocoa is an NSTokenField, but there doesn't seem to be an equivalent for Cocoa Touch.
Since iOS 13 there exists UISearchTextField.
https://developer.apple.com/documentation/uikit/uisearchtextfield
You can see that component in action in the Photos App.
That should fit for many use cases. By removing the leftView you can also get rid of the search icon.
But be aware: You can‘t mix text and tokens at various positions.
From the docs:
Tokens always occur contiguously before any text in the search field.
Adding this here for reference:
Feel free to check out TaggerKit (a library I made), it's more or less what OP was talking about. You can basically add tags functionality to your app by just adding a view and a couple of properties.
I dont think you can do it with any built in functionality in the SDK, never seen such a feature. What you could do however is implement it yourself, have some custom blue button with some text over it, and when the user hits return you can have some code that takes the text and returns you the button that you need, shouldnt be too bad to implement

Iphone SDK, switch keyboard in app

I have one question, may be it is very simple, but I do not know about this nothing...
For example, I have an application, application with textfield, I want to know two things.
First: Is possible to switch keyboard when application in runtime?
Second: how I can switch type of keyboard(Russian, English, Swedish, etc.) in my application*?
*-without going to Settings->General->Keyboard->add new keyboard.
Not sure about changing languages (I did find this other post about it: change input source language programmatically OSx), but changing the keyboard is pretty easy. Here is a one line example:
textField.keyboardType = UIKeyboardTypeURL;
Take a look at the UITextInputTraits protocol reference for more info. Then the question comes in where to implement this. I am assuming that you want to check conditions right before the keyboard comes up, you may have to implement UITextFieldDelegate protocol (and maybe using the field's tag to see which field the cursor is in).
Hope this helps.

GWT: creating a text widget for highly customized data entry

I'm trying to implement a kind of "guided typing" widget for data entry, in which the user's text entry is highly controlled and filtered. When the user types a particular character I need to intercept and filter it before displaying it in the widget. Imagine if
you will, a Unix shell embedded as a webapp; that's the kind of thing I'm trying to implement. I've tried two approaches.
In the first, I extend a TextArea, and add a KeyPressHandler to filter the characters. This works, but the browser-provided spelling correction is totally inappropriate, and I don't see how to turn it off. I've tried:
DOM.setElementProperty(textArea.getElement(),
"spellcheck", "false");
But that seems to have no effect- I still get the red underlines over
"typos".
In the second approach I use a FocusWidget to get KeyPress events, and a separate Label or HTML widget to present the filtered characters back to the user. This avoids the spelling correction issue, but since the FocusWidget is not a TextArea, the browser tends to intercept certain typed characters for internal use; e.g. FireFox will use the "/" character to begin a "Quick Find" on the page, and hitting Backspace will load the previous web page.
Is there a better way to accomplish what I'm trying to do?
You might just be able to use event.preventDefault() on your keypress events to avoid these browser behaviors. Otherwise, maybe a hybrid of the two approaches? Have a hidden TextArea with focus, accepting key events, and then post the typed characters to a separate Label.
There is no specific GWT method on TextBox for this, but this simple line of
GWT code fixes the problem for Chrome (for other browsers, YMMV - it may depend upon how completely they implement HTML5) by setting an attribute on the underlying input element:
myTextBox.getElement().setAttribute("spellCheck", "false");
Perhaps this attribute is a relatively new feature.

Is there an iPhone equivalent to the NSTokenField control?

In my app I want the user to type names into a UITextField (or equivalent) and then when they press return, it will put that word(s) in a blue bubble that's usually associated with tags. The cursor then moves to the end where they can add more "tags".
This can be seen when adding contacts in the To, CC & BCC fields in the Mail app, and also when selecting contacts in the Messages app.
How is this done? Is it something that's provided in the UIKit or available somewhere else?
Many thanks,
Michael
Venmo just open sourced their token field.
https://github.com/venmo/VENTokenField.git
edited:
The equivalent control in desktop Cocoa is an NSTokenField, but there doesn't seem to be an equivalent for Cocoa Touch.
Since iOS 13 there exists UISearchTextField.
https://developer.apple.com/documentation/uikit/uisearchtextfield
You can see that component in action in the Photos App.
That should fit for many use cases. By removing the leftView you can also get rid of the search icon.
But be aware: You can‘t mix text and tokens at various positions.
From the docs:
Tokens always occur contiguously before any text in the search field.
Adding this here for reference:
Feel free to check out TaggerKit (a library I made), it's more or less what OP was talking about. You can basically add tags functionality to your app by just adding a view and a couple of properties.
I dont think you can do it with any built in functionality in the SDK, never seen such a feature. What you could do however is implement it yourself, have some custom blue button with some text over it, and when the user hits return you can have some code that takes the text and returns you the button that you need, shouldnt be too bad to implement

Controlling initial shift status (and layout?) of iPhone keyboard from web form

I would like to be able to control the initial shift state of the iPhone keyboard from a Javascript prompt (updates added for web forms). It seems to mostly default to an initial capital but I feel sure I've typed into/seen prompts that are initially lower-case. I also feel sure that I've seen custom layouts used from the web.
Googling around initially (see updates) didn't reveal any obvious documentation or previous answers besides saying that having "phone" or "zip" in the class of the input would bring up the numeric keyboard (although this may have stopped working). Apparently "url" or "email" could select the appropriate layouts also. This obviously doesn't apply to javascript prompts, and may not work in some versions.
Is there any official source for all this stuff? Does it work across all firmware versions? Has anyone got a general solution for changing keyboard layout or for doing this in Javascript prompts?
UPDATE
For web forms: found this from Apple straight after posting the question, along with this. The question still stands for Javascript prompts.
UPDATE 2
Doh! This is also useful; placeholder text and search button not mentioned in the Apple links. Some more relevant info here.
How do I control which keyboard is displayed when a user touches a text field?
You can control which type of keyboard is displayed when a user touches a text field in a web page. To display a telephone keypad, an email keyboard, or a URL keyboard, use the tel, email, or url keywords for the type attribute on an input element, respectively. To display a numeric keyboard, set the value of the pattern attribute to "[0-9]" or "\d".
These keywords and the pattern attribute are part of HTML 5, and are available in iPhone OS 3.1 and later. See Listing 15 to see how to display each type of keyboard, including the standard keyboard.
Listing 15: Controlling keyboard display
Text:
Telephone:
URL:
Email:
Zip Code:
See http://developer.apple.com/library/safari/#codinghowtos/Mobile/UserExperience/index.html