I know it might sounds stupid but I have an input field, in my C# script I get it using this
public Text emailInput;
public string email = emailInput.text;
but let's say I got my email ' calin.onaca#icloud.com '.
If after I write the email and it only display ' calin.onaca#icloud.co' or 'alin.calin#icloud.com' because of font size it might not display all the text which is fine, but the code receives only the displayed text.
Is it normal? How can I get all text not only the displayed one.
Thank you in advance.
Assuming this is a standard Unity InputField, you'll want to use that type instead.
public InputField emailInput;
var email = emailInput.text;
If you try to grab just the inner Text child of the InputField, you'll see inconsistent results.
Related
When I enter text into the text field it gets removed.
Here is the code:
String barcode="0000000047166";
WebElement element_enter = _driver.findElement(By.xpath("//*[#id='div-barcode']"));
element_enter.findElement(By.xpath("//html/body/div[1]/div[3]/div[1]/form/div/div/input")).sendKeys("barcode");
Agree with Subir Kumar Sao and Faiz.
element_enter.findElement(By.xpath("//html/body/div[1]/div[3]/div[1]/form/div/div/input")).sendKeys(barcode);
I had a case where I was entering text into a field after which the text would be removed automatically. Turned out it was due to some site functionality where you had to
press the enter key after entering the text into the field. So, after sending your barcode text with sendKeys method, send 'enter' directly after it. Note that you will have to import the selenium Keys class. See my code below.
import org.openqa.selenium.Keys;
String barcode="0000000047166";
WebElement element_enter = driver.findElement(By.xpath("//*[#id='div-barcode']"));
element_enter.findElement(By.xpath("your xpath")).sendKeys(barcode);
element_enter.sendKeys(Keys.RETURN); // this will result in the return key being pressed upon the text field
I hope it helps..
Use this code.
driver.FindElement(By.XPath(".//[#id='header']/div/div[3]/div/form/input[1]")).SendKeys("25025");
It might be the JavaScript check for some valid condition.
Two things you can perform a/c to your requirements:
either check for the valid string-input in the text-box.
or set a loop against that text box to enter the value until you post the form/request.
String barcode="0000000047166";
WebElement strLocator = driver.findElement(By.xpath("//*[#id='div-barcode']"));
strLocator.sendKeys(barcode);
Can I validate a user from entering zalgo texts to a form or any other place which prompts a data save, as explained in [Zalgo Texts]: How does Zalgo text work?
As per your need you can use the following to validate a string as such.
Furthermore you can use strip-combining-marks if you want to remove Unicode combining marks from strings.
function validateZalgo(s) {
return /[^\u+0300-\u+036F]/.test(s);
}
var isValidated = validateZalgo('asd̨͈̺̱̤͚̤͚̤͚͈̆̆̆̆̆̆̆̆̆̆');
alert(isValidated);
I'm adding a US phone number to a form in Kentico 9 but the format is not consistent. When I create my form in the Form Builder it looks like this:
Well Formatted US phone format
However when I view the form it Kentico splits up the phone number into it's component parts and places them all on one line. I'm not finding a place to fix this. Seems like a silly way to work...
Bad Phone image
I've tried creating Custom Layouts but it doesn't appear to allow you to control the format there.
I am not sure if I understand you right - you have a form with field (Data type: text) which is using U.S. phone number form control. You can specify proper behavior in ~/CMSFormControls/Inputs/USphone.ascx (default path where are files for this form control). You can specify css classes in USphone.ascx and general behavior in USphone.ascx.cs file. Please note this property:
public override object Value
{
get
{
if (IsEmpty())
{
return String.Empty;
}
return String.Format("({0}) {1}-{2}", txt1st.Text, txt2nd.Text, txt3rd.Text);
}
.
.
.
}
In return there is specified way you are formatting text - this might help you to achieve your desired behavior.
I have some problem with autocomplete. And my question is: Can I send my own personally typed text instead object from autocomplete list?
When I send object from list to "person.eamil" it's ok, but
when I send normal text to "person.email" I get null instead my text.
Here is my HTML code:
<md-autocomplete
ng-model="person.email"
ng-disabled="false"
md-no-cache="true"
md-selected-item="person.email"
md-search-text-change="setPersonValidEmail(person, !innerForm.email.$error.email);"
md-search-text="searchText"
md-items="item in people"
md-item-text="item.email"
md-min-length="0"
placeholder="some#one.com"
ng-click="addOurPersonIfNecessary($index);"
name = "email">
<md-item-template>
<span md-highlight-text="searchText" md-highlight-flags="^i">{{item.name}}</span>
</md-item-template>
</md-autocomplete>
Md-selected-item here is expecting an object that is populated in people. Only then it can populate the auto complete. You can pass the text to md-search-text
I found solution. Try to use another autocomplete plugin like this:
https://github.com/ghiden/angucomplete-alt
I have a textareaField in Silverstripe Backend in Edit Page View... The text to insert contains linebreaks. If I save the Page the text shows correctly with linebreaks in the textareaField. The linebreaks are for sure saved correctly to the database. But how do I display the text correctly in the frontend? It´s always outputted without linebreaks in a single line.
I tried already $Text.RAW, $Text.XML,... nothing works.
Thanks for the help,
Kind regards,
Florian
Assuming that you are using 3.0 this is a bug. You can see it here http://open.silverstripe.org/ticket/7596
A work around is to write your own function calling nl2br on your text field.
Here is an example:
public function NiceDescription () {
return (nl2br (Convert::raw2xml ($this->Description), true));
}
You can replace "Description" with the name of your text property.
Then in your template file if you need to display the description field you will call the function:
$NiceDescription
to visually render the newlines in html, you need to convert them to <BR> tags.
see http://php.net/manual/de/function.nl2br.php