Phone Input field flag and name of country - react-phone-number-input

I have used PhoneInput. It is working perfectly but I want name along with flag but in this code only flag is showing. Can it possible to show both name and flag of country.
Here is my code-
<PhoneInput className="bcont" value={user.bcontact} onChange={bcontact => setUser({ bcontact })}/>

There are a few ways to achieve this:
Use the PhoneInput.getCountryData() method to retrieve an array of country data objects. Each object in the array contains a name and flag property. Then, use the array index of the selected country to display the corresponding name and flag.
Use the PhoneInput.onCountryChange() event to trigger a function that updates the state with the selected country's name and flag.
Use the PhoneInput.formatNumber() method to format the phone number as a string with the country code and name. The country code can be used to lookup the country name and flag from an external data source.

Related

Can I display the current value in a goto or from tag

I have a Simulink Model with with multiple GotoFrom Tags. Instead of their individual name i want to display their current value. In the following picture i would want to substitute A with its respective value.

How to create a display,or similar, method with paramater?

in my myForm I call in a tableMY a displayMethod_fieldA.
In myForm I insered a some date in a DateEdit and I want to make a selection in table using the entered value. If I crete a displayMethod whit parameter I have an error.
Look like this code I get error:
display myEDTField displayMethod_fieldA (date _dateFromForm)
{
tableMY table;
select table
where table.item == this.item
&& table.dateTable == _dateFromForm;
return table.valueFieldA;
}
I have an error looklike this:
The display method has an incorrect parameter profile.
There is another way to display or set the value in my StrinEdit in Grid by method passing a parameter?
In web I saw the method modifier modifierMothod , but I need some more explanation. I don't know if this method is a right way.
Display methods are not designed with this feature.
display method for a table, form, report, or report design does not
have any parameters. For example: display Amount amount()
A display method for a form data source does require a parameter. You
use the
parameter to specify a table buffer. The type of the table buffer has
to match the type of the table in the form data source.
https://msdn.microsoft.com/en-us/library/aa595058.aspx
You can create the desired behaviour with an edit method (and setting the field to AllowEdit(false) or enabled(false).

manually enter data to form

The user enters input to fill the form, but I want to manually complete one field. I've tried using document.getElementById(certificate_request_commonname__row).createAttribute("value","abc");
but it doesn't work. In the form i'm adding data to a table. certificate_request is the name of the table and commonname is the column name. After I've looked on the web2py book I saw that I have to write: tablename_columnname__row. I've done that but it doesn't work. it always says to me: Empty string passed to getElementById(). Can anyone help?
certificate_request_commonname__row is just a wrapper element that contains the input element. Instead, you must identify the input element itself. Also, don't use createAttribute -- just set the .value attribute:
document.getElementById('certificate_request_commonname').value = 'abc'

How to replace a date in a date list using SSJS in XPages

I have a date list field and need to replace a value in the list with another value
so I have this list of type "date list"
The user enter a new value in a date field in the webpage. This new value should be added to in this case the second item in the date list, but it in the real case it should be able to be added to any position in the list
This is the inputfield where user enter a new date
<xp:inputText id="inputText1">
<xp:this.converter>
<xp:convertDateTime pattern="yyyy-MM-dd"></xp:convertDateTime>
</xp:this.converter>
</xp:inputText>
This is the code I use in my button that should replace the date
doc is a data source on the XPage
var v:java.util.Vector = doc.getDocument().getItemValueDateTimeArray("TDate")
v.setElementAt(getComponent("inputText1").getValue(),1)
doc.replaceItemValue("TDate",v)
doc.save()
Not sure what I am doing wrong here, but I seem to have two problems, first the field only seem to contain one element after I save, and secondly the date that is added contain both date and time, and not only the date
This is the result after running the code
Running the same kind of code using a multivalue "text" field works fine.
how can I modify my code so that my replace operation in the date list works
to set a date value without the time part
get a DateTime object and call the function setAnyTime() on the NDT object and replace the item
to set a specific time value in a multivalue datetime field
get the field you will get a vector with all the datetime object.
Get the specific timedate in the vector change it and set it back to the vector. and after that replace the item

Perl/Tk : Getting the selected value of option menu

I am developing one interface in Perl/Tk.
In that I am using one optionmenu to list the names of the users.
And while selecting the user from optionmenu it should display corresponding date of birth of the employee.
And I should be able to update the date of birth of the selected user.
I have written the following code.
$dob_label = $form_name -> Label(-text=>"BirthDay")->place(-x=>150,-y=>200);
$dob=$form_name->DateEntry(-width=>11,-parsecmd=>\&parse,-formatcmd=>\&format)->place(-x=>250,-y=>200);
$ename = $form_name->Optionmenu(-variable=>\$select_value,-options => [#names],
-command=>sub {&get_id_date($hash_ref,$eid,$dob,$_[-1])})->place(-x=>250, -y=>100);
$post_button=$form_name->Button(-text=>"Add",-command=>[\&Add_Birthday,$select_value,$dob,"edit"])->place(-x=>250,-y=>275);
The function get_id_date is used to get the id and dob of employee using the name of the employee.
It is returning the correct id and dob.
Then I edited the dob of the employee.
And I am calling Add_Birthday function to save the changes into database.
But what is the problem in this is,the variable $select_value is always having the value of first name in the optionmenu.
Actually it should have the value of the last selected item in the optionmenu.
So what is the problem in this code,
Please give the solution for this also.
Thanks in advance.
When you create the Button, you are passing the current value of $select_value to the button/command set up. By the time you press the button, the old value of $select_value has already been evaluated and set in the command argument list. You need to make your command a closure, so that $select_value is not evaluated until the button is pressed, e.g.:
-command => sub { Add_Birthday($select_value, "dob", $edit) }
For completeness, I should also mention that another way of doing this is to pass in references:
-command => [\&Add_Birthday, \$select_value, "dob", \$edit]
But that requires rewriting the function to accommodate the references in the argument list.