Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error string/exclamation mark not showing on validation fail #49

Open
asknask opened this issue Sep 30, 2016 · 9 comments
Open

Error string/exclamation mark not showing on validation fail #49

asknask opened this issue Sep 30, 2016 · 9 comments

Comments

@asknask
Copy link

asknask commented Sep 30, 2016

I have the FormEditText wrapped in the TextInputLayout class if that matters.

Whenever I test the validation, the error or the exclamation mark don't show. I have to manually focus the culprit field to get the error string shown.

This causes a lot of issues as the user doesn't know what the problem is.

Here's the xml:

<android.support.design.widget.TextInputLayout
                android:id="@+id/til_tradingName"
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:hint="@string/trading_name">

                <com.andreabaccega.widget.FormEditText
                    android:id="@+id/tradingName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textCapWords"
                    app:testType="nocheck"/>

            </android.support.design.widget.TextInputLayout>
@vekexasia
Copy link
Owner

That seems strange. Which version of the lib are you usign?

@asknask
Copy link
Author

asknask commented Sep 30, 2016

1.3.3.

It is indeed strange. Shall I share my entire xml?

Maybe it has something to do with the fact that I have 4 columns of
FormEditTexts on one horizontal layout. If I keep pressing enter to go to
the next field, some fields get skipped.

On Sep 30, 2016 9:03 PM, "Andrea Baccega" [email protected] wrote:

That seems strange. Which version of the lib are you usign?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#49 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMaIfp8quhl2YXJAU0lvq1kUvdggzWbYks5qvTLWgaJpZM4KLBCy
.

@vekexasia
Copy link
Owner

It is probably due to your layout. Did you try to place it out the column
layout?

Il 30 set 2016 6:32 PM, "Asim Shahzad" [email protected] ha
scritto:

1.3.3.

It is indeed strange. Shall I share my entire xml?

Maybe it has something to do with the fact that I have 4 columns of
FormEditTexts on one horizontal layout. If I keep pressing enter to go to
the next field, some fields get skipped.

On Sep 30, 2016 9:03 PM, "Andrea Baccega" [email protected]
wrote:

That seems strange. Which version of the lib are you usign?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/vekexasia/android-edittext-validator/
issues/49#issuecomment-250784025>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/
AMaIfp8quhl2YXJAU0lvq1kUvdggzWbYks5qvTLWgaJpZM4KLBCy>
.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#49 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAMPS2pZWoig0CBMAE0ZnYWAa_va4Egaks5qvTmvgaJpZM4KLBCy
.

@asknask
Copy link
Author

asknask commented Sep 30, 2016

On Fri, Sep 30, 2016 at 9:51 PM, Andrea Baccega [email protected]
wrote:

It is probably due to your layout. Did you try to place it out the column
layout?

Il 30 set 2016 6:32 PM, "Asim Shahzad" [email protected] ha
scritto:

1.3.3.

It is indeed strange. Shall I share my entire xml?

Maybe it has something to do with the fact that I have 4 columns of
FormEditTexts on one horizontal layout. If I keep pressing enter to go to
the next field, some fields get skipped.

On Sep 30, 2016 9:03 PM, "Andrea Baccega" [email protected]
wrote:

That seems strange. Which version of the lib are you usign?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/vekexasia/android-edittext-validator/
issues/49#issuecomment-250784025>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/
AMaIfp8quhl2YXJAU0lvq1kUvdggzWbYks5qvTLWgaJpZM4KLBCy>
.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://github.com/vekexasia/android-edittext-validator/
issues/49#issuecomment-250790986>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/
AAMPS2pZWoig0CBMAE0ZnYWAa_va4Egaks5qvTmvgaJpZM4KLBCy>
.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#49 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMaIfjBjmeJ0qduK8mOTAMvyy1rREDs9ks5qvT4VgaJpZM4KLBCy
.

Regards,
Asim Shahzad
Software Developer
Nettech Limited

@asknask
Copy link
Author

asknask commented Sep 30, 2016

 <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".SalesForm1">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:weightSum="2">

    <ScrollView
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal|center_vertical"
            android:orientation="vertical">

            <android.support.design.widget.TextInputLayout
                android:id="@+id/til_tradingName"
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:hint="@string/trading_name">

                <com.andreabaccega.widget.FormEditText
                    android:id="@+id/tradingName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textCapWords"
                    app:testType="nocheck"/>

            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:id="@+id/til_address"
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:hint="@string/address">

                <com.andreabaccega.widget.FormEditText
                    android:id="@+id/address"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textPostalAddress"
                    app:testType="nocheck"/>

            </android.support.design.widget.TextInputLayout>

            <LinearLayout
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:orientation="horizontal">

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/til_postcode"
                    android:layout_width="145dp"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="5dp"
                    android:hint="@string/postcode">

                    <com.andreabaccega.widget.FormEditText
                        android:id="@+id/postcode"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="textCapCharacters"
                        app:testType="nocheck"/>

                </android.support.design.widget.TextInputLayout>

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/til_phone"
                    android:layout_width="145dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="5dp"
                    android:hint="@string/phone">

                    <com.andreabaccega.widget.FormEditText
                        android:id="@+id/phone"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="phone"
                        app:testType="phone"/>

                </android.support.design.widget.TextInputLayout>

            </LinearLayout>

            <LinearLayout
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:gravity="center_vertical"
                android:orientation="horizontal">

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/til_fax"
                    android:layout_width="145dp"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="5dp"
                    android:hint="@string/fax">

                    <com.andreabaccega.widget.FormEditText
                        android:id="@+id/fax"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="phone"
                        app:testType="phone"/>

                </android.support.design.widget.TextInputLayout>

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/til_mobile"
                    android:layout_width="145dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="5dp"
                    android:hint="@string/mobile">

                    <com.andreabaccega.widget.FormEditText
                        android:id="@+id/mobile"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="phone"
                        app:testType="phone"/>

                </android.support.design.widget.TextInputLayout>

            </LinearLayout>

            <android.support.design.widget.TextInputLayout
                android:id="@+id/til_companyName"
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:hint="@string/company_name">

                <com.andreabaccega.widget.FormEditText
                    android:id="@+id/companyName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textCapWords"
                    app:testType="nocheck"/>

            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:id="@+id/til_directorName"
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:hint="@string/director_full_name">

                <com.andreabaccega.widget.FormEditText
                    android:id="@+id/directorName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textPersonName"
                    app:testType="personFullName"/>

            </android.support.design.widget.TextInputLayout>

        </LinearLayout>
    </ScrollView>

    <View
        android:layout_width="1dp"
        android:layout_height="match_parent"
        android:background="@color/dividerColor"/>

    <ScrollView
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal|center_vertical"
            android:orientation="vertical">

            <android.support.design.widget.TextInputLayout
                android:id="@+id/til_regNo"
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:hint="@string/company_reg_no">

                <com.andreabaccega.widget.FormEditText
                    android:id="@+id/regNo"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textCapCharacters"
                    app:testType="nocheck"/>

            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:id="@+id/til_clientClassification"
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:hint="@string/client_classification">

                <com.andreabaccega.widget.FormEditText
                    android:id="@+id/clientClassification"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textCapWords"
                    app:testType="nocheck"/>

            </android.support.design.widget.TextInputLayout>

            <CheckBox
                android:id="@+id/checkboxAppointment"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="24dp"
                android:text="@string/view_by_appointment_only"/>

            <LinearLayout
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:orientation="horizontal"
                android:gravity="center">

                <CheckBox
                    android:id="@+id/checkboxSMS"
                    android:layout_width="80dp"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="2dp"
                    android:layout_marginEnd="4dp"
                    android:text="@string/sms"
                    android:layout_gravity="bottom"/>

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/til_messageCell"
                    android:layout_width="216dp"
                    android:layout_height="wrap_content"
                    android:hint="@string/telephone"
                    android:visibility="gone">

                    <com.andreabaccega.widget.FormEditText
                        android:id="@+id/messageCell"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="phone"
                        app:testType="phone"/>

                </android.support.design.widget.TextInputLayout>

            </LinearLayout>

            <LinearLayout
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:orientation="horizontal">

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/til_maxcars"
                    android:layout_width="145dp"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="5dp"
                    android:hint="@string/maximum_cars">

                    <com.andreabaccega.widget.FormEditText
                        android:id="@+id/maxcars"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="number"
                        app:testType="numeric"/>

                </android.support.design.widget.TextInputLayout>

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/til_carInitials"
                    android:layout_width="145dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="5dp"
                    android:hint="@string/initials">

                    <com.andreabaccega.widget.FormEditText
                        android:id="@+id/carInitials"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="textCapCharacters"
                        app:testType="nocheck"/>

                </android.support.design.widget.TextInputLayout>

            </LinearLayout>

            <LinearLayout
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:orientation="horizontal">

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/til_dealerships"
                    android:layout_width="145dp"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="5dp"
                    android:hint="@string/no_of_dealerships">

                    <com.andreabaccega.widget.FormEditText
                        android:id="@+id/dealerships"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="number"
                        app:testType="numeric"/>

                </android.support.design.widget.TextInputLayout>

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/til_dealershipInitials"
                    android:layout_width="145dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="5dp"
                    android:hint="@string/initials">

                    <com.andreabaccega.widget.FormEditText
                        android:id="@+id/dealershipInitials"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="textCapCharacters"
                        app:testType="nocheck"/>

                </android.support.design.widget.TextInputLayout>

            </LinearLayout>
        </LinearLayout>
    </ScrollView>
</LinearLayout>

<com.dmitrymalkovich.android.ProgressFloatingActionButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentEnd="true"
    android:layout_gravity="bottom|end"
    android:clickable="true">

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/login_24dp"
        app:fabSize="normal"/>

    <ProgressBar
        android:id="@+id/submit_fab_progress"
        style="@style/Widget.AppCompat.ProgressBar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="invisible"/>

</com.dmitrymalkovich.android.ProgressFloatingActionButton>
`

@asknask
Copy link
Author

asknask commented Oct 3, 2016

Can this be fixed?

EDIT: A temporary workaround for anyone facing the issue. Modify your for loop for validation. Make it something like this. As soon as the problematic field has focus, the error shows up.

for(FormEditText field : fields)
    {
        if(field.testValidity())
        {
            validation = true;
        }
        else
        {
            validation = false;
            field.requestFocus();
            break;
        }
    }

@dimparf
Copy link

dimparf commented Oct 26, 2016

The same problem. +1

@diandian71
Copy link

i have same problem
i use compile 'com.android.support:design:25.0.1'
i see code ,so i find DefaultEditTextValidator-->
@OverRide
public void showUIError() {
if (mValidator.hasErrorMessage()) {
try {
TextInputLayout parent = (TextInputLayout) editText.getParent();
parent.setErrorEnabled(true);
parent.setError(mValidator.getErrorMessage());
} catch (Throwable e) {
editText.setError(mValidator.getErrorMessage());
}
}
}

should be
TextInputLayout parent = (TextInputLayout) editText.getParentForAccessibility();

@vekexasia
Copy link
Owner

vekexasia commented Dec 12, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants