question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enabled country selection in readonly input

See original GitHub issue

I think it will be useful if it will be some option to enable readonly mode for input while country dropdown continue working. Why I need this ? In my case I use 2 inputs with intlTelInput . First only for country code (that must be change only trough dropdown ) and use this settings

    nationalMode: false,
    autoHideDialCode: false,

and second for mobile number

  nationalMode: true,
  autoHideDialCode: false,

So to make first input disabled for editing we need to remove

 !that.telInput.prop("readonly")

from this lines

        selectedFlag.on("click" + this.ns, function(e) {
                // only intercept this event if we're opening the dropdown
                // else let it bubble up to the top ("click-off-to-close" listener)
                // we cannot just stopPropagation as it may be needed to close another instance
                if (that.countryList.hasClass("hide") && !that.telInput.prop("disabled") && !that.telInput.prop("readonly")) {
                    that._showDropdown();
                }
            });

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
sbsurfcommented, Jan 22, 2016

+1. Would be very useful to use this control as a country + country code dropdown only.

0reactions
jackocnrcommented, Jan 23, 2016

Well then yes issue 317 will solve your problem because it will display the selected country code, and the user wont be able to edit it, and you’ll be able to use getSelectedCountryData to get the value. You can just hide the input as you wont need it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML form readonly SELECT tag/input - Stack Overflow
If you reenable your SELECT, you should copy its value to the hidden input in an onchange event and disable (or remove) the...
Read more >
HTML attribute: readonly - HTML: HyperText Markup Language
The Boolean readonly attribute, when present, makes the element not mutable, meaning the user can not edit the control.
Read more >
HTML input readonly Attribute - W3Schools
The readonly attribute can be set to keep a user from changing the value until some other conditions have been met (like selecting...
Read more >
Allow selecting and copying text from inputs with Enabled=false
The reason we need a ReadOnly state is because the user can not highlight to select the text to copy/paste if desired... that...
Read more >
Forms in HTML documents - W3C
submit buttons: When activated, a submit button submits a form. ... The INPUT element is used to create a file select control. hidden...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found