Input pattern - Mobile number - Start with a specific numbers and character - reactjs

I'm working with react js and i have a input field type tel the backend was designed to accept the phone number starting with +251 if it doesn't start with that it will not send. so what attribute can i add to make that happen and to be visible like a placeholder but character "+251" are in the input the user cant change it but add on to it?

Found this for you https://www.30secondsofcode.org/css/s/input-with-prefix, just an example of how you can handle this with a span next to your input

Related

Firefox returns blank $viewValue when type="number" with space in field

I'm trying to setup a credit card entry field, and I need to be able to separate the digit-groups with a space. But on a mobile device, I want the number keyboard to appear, so I'm using input[type="number"] instead of just input[type="text"].
Currently, when I test on Chrome it's working. The $viewValue appearing in the directive for the credit card field shows the 16-digit number (Angular even auto-removes the spaces because of number type field).
But in Firefox, as soon as you type a space, $viewValue returns as "" (even though the field value is "5555 5555 5555 4444").
Is there any way to make this work as expected?
Wow Maybe this a serious Mozilla Bug, with no solution for now, then you may apply other ways to resolve this.
Use mask (lose number on mobile): Try Plugins, library like this http://digitalbush.com/projects/masked-input-plugin/ , the bad user loses the PAD NUMBER on mobile devices.
To keep input number (complex only for fun): Make a input type hidden, then when the user type on number field, fill the hidden input with the value.
Use text field (best way): yes number is the new era on HTML5, but users don't care that for now, yeah show only numbers with the pad (like most apps) is awesome, now ask is really necesary?
Dynamic Form JS: verify the browser version, if Wild Mozilla appears, change type number to type text ;)
Good luck !!
best regards from http://elporfirio.com

How to substitute an end of line character from Salesforce Text Area field

I am using a text area field in Salesforce as a RecipientNote for a Docusign envelope created using a custom button in Salesforce.
The syntax below handles any commas or special characters, but I'm unable to find the correct syntax to preserve any linebreaks in the Program_Exception_Notes__c field.
;RecipientNote~{!JSENCODE(URLENCODE(SUBSTITUTE(Sales_Program_Info__c.Program_Exception_Notes__c,",","_COMMA_")))}
I have tried the following but none worked. Any ideas?
'{!SUBSTITUTE(JSENCODE(URLENCODE(SUBSTITUTE(Sales_Program_Info__c.Program_Exception_Notes__c,",","_COMMA_"))),"%0D%0A","\\n")}'
'{!JSENCODE(URLENCODE(SUBSTITUTE(SUBSTITUTE(Sales_Program_Info__c.Program_Exception_Notes__c,"\r\n","\\n"),",","_COMMA_")))}'
I would process your text in a couple of steps in jscript.
first break the text into an array of string lines
escape characters you are looking to correct
then reassemble using the "\n" when you put it back together into a var
Then after all that, URL and JS encode that string variable.

How to make ui-mask retain the invalid input when focus is lost?

I'm very new to ui-mask module in AngularJS UI.
When I use it, I noticed that if the user enters an invalid format, and moved the focus to another control,the input will be cleared.
How to make ui-mask retain the invalid input when focus is lost?
I want to show an error tooltip like 'this field is invalid' to users rather than clearing their input.
===============================
Update:
Thanks to majorlazer.
The ? mark works, for example, when the mask is ?99/9999, the input will not be cleared.
But there is a small problem about the place holder.
My mask is ?99/9999, and my place holder is
'__/____' (2 underscores and a slash and 4 underscores)
But when the input does not have focus, it shows
'_//____' (1 underscore and two slashes and 4 underscores)
Do you have any idea?
I found a potential solution from another posting here, but it was for jquery. Try adding a question mark in front of the mask, making it optional like ui-mask('?999-999-9999'). Note that it keeps the mask and the value when you leave focus, but won't validated.

ng input number with input type = text

I would like to use angular's number validation, however it looks like it requires input type=number? usually this would be fine, except I don't want the up and down arrows that appear to the right of this type of input by default.
Is there an alternative solution? I tried using ng input number with input text but it didn't work for me :/
Use <input type="number" />
And read this article: Can I hide the HTML5 number input’s spin box?

Why are Paragraph spaces being omitted

I have a form which accepts varchar2(5000). It is basically a description field. Now when users enter spces after paragraphs, they are all combined into on paragraph, and not multiple as it is entered.
Why? Ex - This is one paragraph.
This is another paragraph.
Here is what is happening -
This is one paragraph.This is another paragraph.
Are you displaying this data on a webpage or via HTML in some way? If so, then white-space is not handled in a straightforward fashion and that might be causing confusion.
Update - it appears that this is being displayed on a webpage.
You need to do one of several things:
Display your text inside a <pre> element on your page
OR
Replace carriage returns in your text with <br/> chars before sending to the webpage
(You might also need to do something with spaces too, if you need to have multiple of them displayed accurately).
This is nothing to do with databases and only to do with how HTML is displayed.
Have a look at this answer Rendering Plaintext as HTML maintaining whitespace – without <pre>

Resources