enabling or disabling validation for a particular EditTextView dynamically though program
MainActivity.XML
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
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"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginTop="50dp">
<android.support.v7.widget.CardView
android:id="@+id/first_name_card"
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:elevation="20dp"
app:cardCornerRadius="5dp">
<EditText
android:id="@+id/first_name"
android:layout_width="match_parent"
android:layout_height="@dimen/text_input_height"
android:background="@color/white"
android:backgroundTint="@color/white"
android:drawablePadding="@dimen/drawable_padding"
android:hint="First Name"
android:imeOptions="actionNext"
android:maxLength="35"
android:inputType="textPersonName"
android:maxLines="1"
android:textSize="@dimen/edit_text_size"
android:padding="10dp"
/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="@+id/last_name_card"
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginLeft="10dp"
android:elevation="20dp"
app:cardCornerRadius="5dp"
android:layout_marginBottom="10dp">
<EditText
android:id="@+id/last_name"
android:layout_width="match_parent"
android:layout_height="@dimen/text_input_height"
android:background="@color/white"
android:backgroundTint="@color/white"
android:drawablePadding="@dimen/drawable_padding"
android:hint="Last Name"
android:imeOptions="actionNext"
android:maxLength="35"
android:inputType="textPersonName"
android:maxLines="1"
android:textSize="@dimen/edit_text_size"
android:padding="10dp"/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginRight="@dimen/margin_low"
android:layout_marginLeft="10dp"
android:layout_gravity="bottom"
app:cardCornerRadius="5dp"
android:elevation="20dp"
android:layout_marginBottom="10dp">
<Spinner
android:id="@+id/doctors_list"
android:layout_width="match_parent"
android:layout_height="@dimen/spinner_height"
android:gravity="left">
</Spinner>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="@+id/ref_name_card"
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginLeft="10dp"
android:elevation="20dp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="5dp">
<EditText
android:id="@+id/reference"
android:layout_width="match_parent"
android:layout_height="@dimen/text_input_height"
android:background="@color/white"
android:backgroundTint="@color/white"
android:drawablePadding="@dimen/drawable_padding"
android:hint="Reference"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:maxLength="70"
android:maxLines="1"
android:textSize="@dimen/edit_text_size"
android:padding="10dp"/>
</android.support.v7.widget.CardView>
<Button
android:id="@+id/submit_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="Submit"/>
</LinearLayout>
</ScrollView>
MainActivity.Java
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private EditText firstName;
private EditText lastName;
private Spinner selDoc;
private EditText reference;
private Button submitBut;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
firstName = findViewById(R.id.first_name);
lastName = findViewById(R.id.last_name);
selDoc = findViewById(R.id.doctors_list);
reference = findViewById(R.id.reference);
submitBut = findViewById(R.id.submit_button);
String dicList = getResources().getStringArray(R.array.doctors_list);
ArrayAdapter<String> docAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, dicList);
selDoc.setAdapter(docAdapter);
setOnListnerClickedItems();
setListeners();
}
private void setOnListnerClickedItems() {
submitBut.setOnClickListener(this);
}
private void setListeners() {
lastName.setVisibility(View.INVISIBLE);
}
@Override
public void onClick(View view) {
int id = view.getId();
switch (id) {
case R.id.submit_button:
String errorMsg = validate();
if (errorMsg.toString().isEmpty()) {
Toast.makeText(MainActivity.this, "Data Saved Successfully", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this, errorMsg, Toast.LENGTH_SHORT).show();
}
break;
}
}
private String validate() {
if (ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) {
return "Please Enter Your First Name";
}
else if (!Validator.isValidName(ComponentUtils.getInputStringFromView(firstName))) {
return "Please Enter Valid First Name";
}
else if (ComponentUtils.getInputStringFromView(lastName).toString().isEmpty()) {
return "Please Enter Your Last Name";
}
else if (!Validator.isValidName(ComponentUtils.getInputStringFromView(lastName))) {
return "Please Enter Valid Last Name";
}
else if (ComponentUtils.getInputStringFromView(selDoc).toString().isEmpty()) {
return "Please Select Doctor";
}
else if (ComponentUtils.getInputStringFromView(reference).toString().isEmpty()) {
return "Please Enter Reference Name";
}
else if (!Validator.isValidReferenceName(ComponentUtils.getInputStringFromView(reference))) {
return "Please Enter Valid Reference Name";
}
else {
return "";
}
}
}
I have 4 fields in the form including firstName, lastName, doctorList, and referenceName. I need to validate all the fields excluding INVISIBLE fields.
As given in the code 3 fields are visible and 1 field i.e. lastName is invisible. But, when I am entering data and clicking on the submit button it's showing error as Please Enter the Last Name. How to validate only visible fields dynamically? Please help me.
java android validation
add a comment |
MainActivity.XML
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
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"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginTop="50dp">
<android.support.v7.widget.CardView
android:id="@+id/first_name_card"
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:elevation="20dp"
app:cardCornerRadius="5dp">
<EditText
android:id="@+id/first_name"
android:layout_width="match_parent"
android:layout_height="@dimen/text_input_height"
android:background="@color/white"
android:backgroundTint="@color/white"
android:drawablePadding="@dimen/drawable_padding"
android:hint="First Name"
android:imeOptions="actionNext"
android:maxLength="35"
android:inputType="textPersonName"
android:maxLines="1"
android:textSize="@dimen/edit_text_size"
android:padding="10dp"
/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="@+id/last_name_card"
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginLeft="10dp"
android:elevation="20dp"
app:cardCornerRadius="5dp"
android:layout_marginBottom="10dp">
<EditText
android:id="@+id/last_name"
android:layout_width="match_parent"
android:layout_height="@dimen/text_input_height"
android:background="@color/white"
android:backgroundTint="@color/white"
android:drawablePadding="@dimen/drawable_padding"
android:hint="Last Name"
android:imeOptions="actionNext"
android:maxLength="35"
android:inputType="textPersonName"
android:maxLines="1"
android:textSize="@dimen/edit_text_size"
android:padding="10dp"/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginRight="@dimen/margin_low"
android:layout_marginLeft="10dp"
android:layout_gravity="bottom"
app:cardCornerRadius="5dp"
android:elevation="20dp"
android:layout_marginBottom="10dp">
<Spinner
android:id="@+id/doctors_list"
android:layout_width="match_parent"
android:layout_height="@dimen/spinner_height"
android:gravity="left">
</Spinner>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="@+id/ref_name_card"
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginLeft="10dp"
android:elevation="20dp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="5dp">
<EditText
android:id="@+id/reference"
android:layout_width="match_parent"
android:layout_height="@dimen/text_input_height"
android:background="@color/white"
android:backgroundTint="@color/white"
android:drawablePadding="@dimen/drawable_padding"
android:hint="Reference"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:maxLength="70"
android:maxLines="1"
android:textSize="@dimen/edit_text_size"
android:padding="10dp"/>
</android.support.v7.widget.CardView>
<Button
android:id="@+id/submit_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="Submit"/>
</LinearLayout>
</ScrollView>
MainActivity.Java
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private EditText firstName;
private EditText lastName;
private Spinner selDoc;
private EditText reference;
private Button submitBut;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
firstName = findViewById(R.id.first_name);
lastName = findViewById(R.id.last_name);
selDoc = findViewById(R.id.doctors_list);
reference = findViewById(R.id.reference);
submitBut = findViewById(R.id.submit_button);
String dicList = getResources().getStringArray(R.array.doctors_list);
ArrayAdapter<String> docAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, dicList);
selDoc.setAdapter(docAdapter);
setOnListnerClickedItems();
setListeners();
}
private void setOnListnerClickedItems() {
submitBut.setOnClickListener(this);
}
private void setListeners() {
lastName.setVisibility(View.INVISIBLE);
}
@Override
public void onClick(View view) {
int id = view.getId();
switch (id) {
case R.id.submit_button:
String errorMsg = validate();
if (errorMsg.toString().isEmpty()) {
Toast.makeText(MainActivity.this, "Data Saved Successfully", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this, errorMsg, Toast.LENGTH_SHORT).show();
}
break;
}
}
private String validate() {
if (ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) {
return "Please Enter Your First Name";
}
else if (!Validator.isValidName(ComponentUtils.getInputStringFromView(firstName))) {
return "Please Enter Valid First Name";
}
else if (ComponentUtils.getInputStringFromView(lastName).toString().isEmpty()) {
return "Please Enter Your Last Name";
}
else if (!Validator.isValidName(ComponentUtils.getInputStringFromView(lastName))) {
return "Please Enter Valid Last Name";
}
else if (ComponentUtils.getInputStringFromView(selDoc).toString().isEmpty()) {
return "Please Select Doctor";
}
else if (ComponentUtils.getInputStringFromView(reference).toString().isEmpty()) {
return "Please Enter Reference Name";
}
else if (!Validator.isValidReferenceName(ComponentUtils.getInputStringFromView(reference))) {
return "Please Enter Valid Reference Name";
}
else {
return "";
}
}
}
I have 4 fields in the form including firstName, lastName, doctorList, and referenceName. I need to validate all the fields excluding INVISIBLE fields.
As given in the code 3 fields are visible and 1 field i.e. lastName is invisible. But, when I am entering data and clicking on the submit button it's showing error as Please Enter the Last Name. How to validate only visible fields dynamically? Please help me.
java android validation
Yeah with invisible edittext you are able to get text from edittext. So you need to change visibility fromINVISIBLE
toGONE
.
– Piyush
Nov 15 '18 at 13:20
did that way too. still, not working @Piyush
– Shruti B
Nov 15 '18 at 13:49
add a comment |
MainActivity.XML
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
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"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginTop="50dp">
<android.support.v7.widget.CardView
android:id="@+id/first_name_card"
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:elevation="20dp"
app:cardCornerRadius="5dp">
<EditText
android:id="@+id/first_name"
android:layout_width="match_parent"
android:layout_height="@dimen/text_input_height"
android:background="@color/white"
android:backgroundTint="@color/white"
android:drawablePadding="@dimen/drawable_padding"
android:hint="First Name"
android:imeOptions="actionNext"
android:maxLength="35"
android:inputType="textPersonName"
android:maxLines="1"
android:textSize="@dimen/edit_text_size"
android:padding="10dp"
/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="@+id/last_name_card"
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginLeft="10dp"
android:elevation="20dp"
app:cardCornerRadius="5dp"
android:layout_marginBottom="10dp">
<EditText
android:id="@+id/last_name"
android:layout_width="match_parent"
android:layout_height="@dimen/text_input_height"
android:background="@color/white"
android:backgroundTint="@color/white"
android:drawablePadding="@dimen/drawable_padding"
android:hint="Last Name"
android:imeOptions="actionNext"
android:maxLength="35"
android:inputType="textPersonName"
android:maxLines="1"
android:textSize="@dimen/edit_text_size"
android:padding="10dp"/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginRight="@dimen/margin_low"
android:layout_marginLeft="10dp"
android:layout_gravity="bottom"
app:cardCornerRadius="5dp"
android:elevation="20dp"
android:layout_marginBottom="10dp">
<Spinner
android:id="@+id/doctors_list"
android:layout_width="match_parent"
android:layout_height="@dimen/spinner_height"
android:gravity="left">
</Spinner>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="@+id/ref_name_card"
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginLeft="10dp"
android:elevation="20dp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="5dp">
<EditText
android:id="@+id/reference"
android:layout_width="match_parent"
android:layout_height="@dimen/text_input_height"
android:background="@color/white"
android:backgroundTint="@color/white"
android:drawablePadding="@dimen/drawable_padding"
android:hint="Reference"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:maxLength="70"
android:maxLines="1"
android:textSize="@dimen/edit_text_size"
android:padding="10dp"/>
</android.support.v7.widget.CardView>
<Button
android:id="@+id/submit_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="Submit"/>
</LinearLayout>
</ScrollView>
MainActivity.Java
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private EditText firstName;
private EditText lastName;
private Spinner selDoc;
private EditText reference;
private Button submitBut;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
firstName = findViewById(R.id.first_name);
lastName = findViewById(R.id.last_name);
selDoc = findViewById(R.id.doctors_list);
reference = findViewById(R.id.reference);
submitBut = findViewById(R.id.submit_button);
String dicList = getResources().getStringArray(R.array.doctors_list);
ArrayAdapter<String> docAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, dicList);
selDoc.setAdapter(docAdapter);
setOnListnerClickedItems();
setListeners();
}
private void setOnListnerClickedItems() {
submitBut.setOnClickListener(this);
}
private void setListeners() {
lastName.setVisibility(View.INVISIBLE);
}
@Override
public void onClick(View view) {
int id = view.getId();
switch (id) {
case R.id.submit_button:
String errorMsg = validate();
if (errorMsg.toString().isEmpty()) {
Toast.makeText(MainActivity.this, "Data Saved Successfully", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this, errorMsg, Toast.LENGTH_SHORT).show();
}
break;
}
}
private String validate() {
if (ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) {
return "Please Enter Your First Name";
}
else if (!Validator.isValidName(ComponentUtils.getInputStringFromView(firstName))) {
return "Please Enter Valid First Name";
}
else if (ComponentUtils.getInputStringFromView(lastName).toString().isEmpty()) {
return "Please Enter Your Last Name";
}
else if (!Validator.isValidName(ComponentUtils.getInputStringFromView(lastName))) {
return "Please Enter Valid Last Name";
}
else if (ComponentUtils.getInputStringFromView(selDoc).toString().isEmpty()) {
return "Please Select Doctor";
}
else if (ComponentUtils.getInputStringFromView(reference).toString().isEmpty()) {
return "Please Enter Reference Name";
}
else if (!Validator.isValidReferenceName(ComponentUtils.getInputStringFromView(reference))) {
return "Please Enter Valid Reference Name";
}
else {
return "";
}
}
}
I have 4 fields in the form including firstName, lastName, doctorList, and referenceName. I need to validate all the fields excluding INVISIBLE fields.
As given in the code 3 fields are visible and 1 field i.e. lastName is invisible. But, when I am entering data and clicking on the submit button it's showing error as Please Enter the Last Name. How to validate only visible fields dynamically? Please help me.
java android validation
MainActivity.XML
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
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"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginTop="50dp">
<android.support.v7.widget.CardView
android:id="@+id/first_name_card"
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:elevation="20dp"
app:cardCornerRadius="5dp">
<EditText
android:id="@+id/first_name"
android:layout_width="match_parent"
android:layout_height="@dimen/text_input_height"
android:background="@color/white"
android:backgroundTint="@color/white"
android:drawablePadding="@dimen/drawable_padding"
android:hint="First Name"
android:imeOptions="actionNext"
android:maxLength="35"
android:inputType="textPersonName"
android:maxLines="1"
android:textSize="@dimen/edit_text_size"
android:padding="10dp"
/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="@+id/last_name_card"
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginLeft="10dp"
android:elevation="20dp"
app:cardCornerRadius="5dp"
android:layout_marginBottom="10dp">
<EditText
android:id="@+id/last_name"
android:layout_width="match_parent"
android:layout_height="@dimen/text_input_height"
android:background="@color/white"
android:backgroundTint="@color/white"
android:drawablePadding="@dimen/drawable_padding"
android:hint="Last Name"
android:imeOptions="actionNext"
android:maxLength="35"
android:inputType="textPersonName"
android:maxLines="1"
android:textSize="@dimen/edit_text_size"
android:padding="10dp"/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginRight="@dimen/margin_low"
android:layout_marginLeft="10dp"
android:layout_gravity="bottom"
app:cardCornerRadius="5dp"
android:elevation="20dp"
android:layout_marginBottom="10dp">
<Spinner
android:id="@+id/doctors_list"
android:layout_width="match_parent"
android:layout_height="@dimen/spinner_height"
android:gravity="left">
</Spinner>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="@+id/ref_name_card"
android:layout_width="match_parent"
android:layout_height="@dimen/card_view_height_patient"
android:layout_marginLeft="10dp"
android:elevation="20dp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="5dp">
<EditText
android:id="@+id/reference"
android:layout_width="match_parent"
android:layout_height="@dimen/text_input_height"
android:background="@color/white"
android:backgroundTint="@color/white"
android:drawablePadding="@dimen/drawable_padding"
android:hint="Reference"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:maxLength="70"
android:maxLines="1"
android:textSize="@dimen/edit_text_size"
android:padding="10dp"/>
</android.support.v7.widget.CardView>
<Button
android:id="@+id/submit_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="Submit"/>
</LinearLayout>
</ScrollView>
MainActivity.Java
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private EditText firstName;
private EditText lastName;
private Spinner selDoc;
private EditText reference;
private Button submitBut;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
firstName = findViewById(R.id.first_name);
lastName = findViewById(R.id.last_name);
selDoc = findViewById(R.id.doctors_list);
reference = findViewById(R.id.reference);
submitBut = findViewById(R.id.submit_button);
String dicList = getResources().getStringArray(R.array.doctors_list);
ArrayAdapter<String> docAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, dicList);
selDoc.setAdapter(docAdapter);
setOnListnerClickedItems();
setListeners();
}
private void setOnListnerClickedItems() {
submitBut.setOnClickListener(this);
}
private void setListeners() {
lastName.setVisibility(View.INVISIBLE);
}
@Override
public void onClick(View view) {
int id = view.getId();
switch (id) {
case R.id.submit_button:
String errorMsg = validate();
if (errorMsg.toString().isEmpty()) {
Toast.makeText(MainActivity.this, "Data Saved Successfully", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this, errorMsg, Toast.LENGTH_SHORT).show();
}
break;
}
}
private String validate() {
if (ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) {
return "Please Enter Your First Name";
}
else if (!Validator.isValidName(ComponentUtils.getInputStringFromView(firstName))) {
return "Please Enter Valid First Name";
}
else if (ComponentUtils.getInputStringFromView(lastName).toString().isEmpty()) {
return "Please Enter Your Last Name";
}
else if (!Validator.isValidName(ComponentUtils.getInputStringFromView(lastName))) {
return "Please Enter Valid Last Name";
}
else if (ComponentUtils.getInputStringFromView(selDoc).toString().isEmpty()) {
return "Please Select Doctor";
}
else if (ComponentUtils.getInputStringFromView(reference).toString().isEmpty()) {
return "Please Enter Reference Name";
}
else if (!Validator.isValidReferenceName(ComponentUtils.getInputStringFromView(reference))) {
return "Please Enter Valid Reference Name";
}
else {
return "";
}
}
}
I have 4 fields in the form including firstName, lastName, doctorList, and referenceName. I need to validate all the fields excluding INVISIBLE fields.
As given in the code 3 fields are visible and 1 field i.e. lastName is invisible. But, when I am entering data and clicking on the submit button it's showing error as Please Enter the Last Name. How to validate only visible fields dynamically? Please help me.
java android validation
java android validation
edited Nov 15 '18 at 13:35
Shruti B
asked Nov 15 '18 at 13:08
Shruti BShruti B
55
55
Yeah with invisible edittext you are able to get text from edittext. So you need to change visibility fromINVISIBLE
toGONE
.
– Piyush
Nov 15 '18 at 13:20
did that way too. still, not working @Piyush
– Shruti B
Nov 15 '18 at 13:49
add a comment |
Yeah with invisible edittext you are able to get text from edittext. So you need to change visibility fromINVISIBLE
toGONE
.
– Piyush
Nov 15 '18 at 13:20
did that way too. still, not working @Piyush
– Shruti B
Nov 15 '18 at 13:49
Yeah with invisible edittext you are able to get text from edittext. So you need to change visibility from
INVISIBLE
to GONE
.– Piyush
Nov 15 '18 at 13:20
Yeah with invisible edittext you are able to get text from edittext. So you need to change visibility from
INVISIBLE
to GONE
.– Piyush
Nov 15 '18 at 13:20
did that way too. still, not working @Piyush
– Shruti B
Nov 15 '18 at 13:49
did that way too. still, not working @Piyush
– Shruti B
Nov 15 '18 at 13:49
add a comment |
3 Answers
3
active
oldest
votes
For that, you need to check the visibility of the field and apply validation among them
For example:
//To check the visibilty of the filed
if(edittLastName.getVisibility() == View.VISIBLE){
vaildateField();
}
Validation Function :
private void vaildateField(){
if(etxLastName.getLength()==0)
Log.e("Error","Enter last name");
}
I want to disable that invisible field dynamically. This is sample code. For this time lastName field is invisible but nexttime maybe another fields will be invisible. So for that i need to validate visible fields only.
– Shruti B
Nov 15 '18 at 13:18
@ShrutiB I update the answer , please check it
– Sniffer
Nov 15 '18 at 13:26
for every field i need to make separate method to validate it. I am validating all fields in single method. How do I escape that single field which is invisible.
– Shruti B
Nov 15 '18 at 13:47
No, it's a basic, you need to apply your own logic or maintain a boolean value, don't expect for full code. I just give the key for playing with visibility of the field
– Sniffer
Nov 15 '18 at 13:50
yes, i got it. Applying the same.
– Shruti B
Nov 15 '18 at 14:05
|
show 2 more comments
Add boolean value
boolean isneedValidation=false;
else if (isneedValidation &&ComponentUtils.getInputStringFromView(selDoc).toString().isEmpty()) {
return "Please Enter Your Email ID";
}
if isneedValidation is true condition will check otherwise it will skip
whenever you want to change the Edittext to visible at the time change the boolean value
no need to take boolean isneedValidation=false; working by putting this code if (firstName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) { return "Please Enter Your First Name"; }
– Shruti B
Nov 15 '18 at 14:18
add a comment |
This is the certain answer of your question.
private String validate() {
if (firstName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) {
return "Please Enter Your First Name";
}
else if (firstName.getVisibility() == View.VISIBLE && !Validator.isValidName(ComponentUtils.getInputStringFromView(firstName))) {
return "Please Enter Valid First Name";
}
else if (lastName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(lastName).toString().isEmpty()) {
return "Please Enter Your Last Name";
}
else if (lastName.getVisibility() == View.VISIBLE && !Validator.isValidName(ComponentUtils.getInputStringFromView(lastName))) {
return "Please Enter Valid Last Name";
}
else if (selDoc.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(selDoc).toString().isEmpty()) {
return "Please Select Doctor";
}
else if (reference.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(reference).toString().isEmpty()) {
return "Please Enter Reference Name";
}
else if (reference.getVisibility() == View.VISIBLE && !Validator.isValidReferenceName(ComponentUtils.getInputStringFromView(reference))) {
return "Please Enter Valid Reference Name";
}
else {
return "";
}
}
This answer is also what @user:5978440 tried to explain you.
– Murat Guc
Nov 15 '18 at 14:09
Thank you for your help. I have done with the same technique. It's working fine
– Shruti B
Nov 15 '18 at 14:23
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53320208%2fenabling-or-disabling-validation-for-a-particular-edittextview-dynamically-thoug%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
For that, you need to check the visibility of the field and apply validation among them
For example:
//To check the visibilty of the filed
if(edittLastName.getVisibility() == View.VISIBLE){
vaildateField();
}
Validation Function :
private void vaildateField(){
if(etxLastName.getLength()==0)
Log.e("Error","Enter last name");
}
I want to disable that invisible field dynamically. This is sample code. For this time lastName field is invisible but nexttime maybe another fields will be invisible. So for that i need to validate visible fields only.
– Shruti B
Nov 15 '18 at 13:18
@ShrutiB I update the answer , please check it
– Sniffer
Nov 15 '18 at 13:26
for every field i need to make separate method to validate it. I am validating all fields in single method. How do I escape that single field which is invisible.
– Shruti B
Nov 15 '18 at 13:47
No, it's a basic, you need to apply your own logic or maintain a boolean value, don't expect for full code. I just give the key for playing with visibility of the field
– Sniffer
Nov 15 '18 at 13:50
yes, i got it. Applying the same.
– Shruti B
Nov 15 '18 at 14:05
|
show 2 more comments
For that, you need to check the visibility of the field and apply validation among them
For example:
//To check the visibilty of the filed
if(edittLastName.getVisibility() == View.VISIBLE){
vaildateField();
}
Validation Function :
private void vaildateField(){
if(etxLastName.getLength()==0)
Log.e("Error","Enter last name");
}
I want to disable that invisible field dynamically. This is sample code. For this time lastName field is invisible but nexttime maybe another fields will be invisible. So for that i need to validate visible fields only.
– Shruti B
Nov 15 '18 at 13:18
@ShrutiB I update the answer , please check it
– Sniffer
Nov 15 '18 at 13:26
for every field i need to make separate method to validate it. I am validating all fields in single method. How do I escape that single field which is invisible.
– Shruti B
Nov 15 '18 at 13:47
No, it's a basic, you need to apply your own logic or maintain a boolean value, don't expect for full code. I just give the key for playing with visibility of the field
– Sniffer
Nov 15 '18 at 13:50
yes, i got it. Applying the same.
– Shruti B
Nov 15 '18 at 14:05
|
show 2 more comments
For that, you need to check the visibility of the field and apply validation among them
For example:
//To check the visibilty of the filed
if(edittLastName.getVisibility() == View.VISIBLE){
vaildateField();
}
Validation Function :
private void vaildateField(){
if(etxLastName.getLength()==0)
Log.e("Error","Enter last name");
}
For that, you need to check the visibility of the field and apply validation among them
For example:
//To check the visibilty of the filed
if(edittLastName.getVisibility() == View.VISIBLE){
vaildateField();
}
Validation Function :
private void vaildateField(){
if(etxLastName.getLength()==0)
Log.e("Error","Enter last name");
}
edited Nov 15 '18 at 13:37
answered Nov 15 '18 at 13:13
SnifferSniffer
7481822
7481822
I want to disable that invisible field dynamically. This is sample code. For this time lastName field is invisible but nexttime maybe another fields will be invisible. So for that i need to validate visible fields only.
– Shruti B
Nov 15 '18 at 13:18
@ShrutiB I update the answer , please check it
– Sniffer
Nov 15 '18 at 13:26
for every field i need to make separate method to validate it. I am validating all fields in single method. How do I escape that single field which is invisible.
– Shruti B
Nov 15 '18 at 13:47
No, it's a basic, you need to apply your own logic or maintain a boolean value, don't expect for full code. I just give the key for playing with visibility of the field
– Sniffer
Nov 15 '18 at 13:50
yes, i got it. Applying the same.
– Shruti B
Nov 15 '18 at 14:05
|
show 2 more comments
I want to disable that invisible field dynamically. This is sample code. For this time lastName field is invisible but nexttime maybe another fields will be invisible. So for that i need to validate visible fields only.
– Shruti B
Nov 15 '18 at 13:18
@ShrutiB I update the answer , please check it
– Sniffer
Nov 15 '18 at 13:26
for every field i need to make separate method to validate it. I am validating all fields in single method. How do I escape that single field which is invisible.
– Shruti B
Nov 15 '18 at 13:47
No, it's a basic, you need to apply your own logic or maintain a boolean value, don't expect for full code. I just give the key for playing with visibility of the field
– Sniffer
Nov 15 '18 at 13:50
yes, i got it. Applying the same.
– Shruti B
Nov 15 '18 at 14:05
I want to disable that invisible field dynamically. This is sample code. For this time lastName field is invisible but nexttime maybe another fields will be invisible. So for that i need to validate visible fields only.
– Shruti B
Nov 15 '18 at 13:18
I want to disable that invisible field dynamically. This is sample code. For this time lastName field is invisible but nexttime maybe another fields will be invisible. So for that i need to validate visible fields only.
– Shruti B
Nov 15 '18 at 13:18
@ShrutiB I update the answer , please check it
– Sniffer
Nov 15 '18 at 13:26
@ShrutiB I update the answer , please check it
– Sniffer
Nov 15 '18 at 13:26
for every field i need to make separate method to validate it. I am validating all fields in single method. How do I escape that single field which is invisible.
– Shruti B
Nov 15 '18 at 13:47
for every field i need to make separate method to validate it. I am validating all fields in single method. How do I escape that single field which is invisible.
– Shruti B
Nov 15 '18 at 13:47
No, it's a basic, you need to apply your own logic or maintain a boolean value, don't expect for full code. I just give the key for playing with visibility of the field
– Sniffer
Nov 15 '18 at 13:50
No, it's a basic, you need to apply your own logic or maintain a boolean value, don't expect for full code. I just give the key for playing with visibility of the field
– Sniffer
Nov 15 '18 at 13:50
yes, i got it. Applying the same.
– Shruti B
Nov 15 '18 at 14:05
yes, i got it. Applying the same.
– Shruti B
Nov 15 '18 at 14:05
|
show 2 more comments
Add boolean value
boolean isneedValidation=false;
else if (isneedValidation &&ComponentUtils.getInputStringFromView(selDoc).toString().isEmpty()) {
return "Please Enter Your Email ID";
}
if isneedValidation is true condition will check otherwise it will skip
whenever you want to change the Edittext to visible at the time change the boolean value
no need to take boolean isneedValidation=false; working by putting this code if (firstName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) { return "Please Enter Your First Name"; }
– Shruti B
Nov 15 '18 at 14:18
add a comment |
Add boolean value
boolean isneedValidation=false;
else if (isneedValidation &&ComponentUtils.getInputStringFromView(selDoc).toString().isEmpty()) {
return "Please Enter Your Email ID";
}
if isneedValidation is true condition will check otherwise it will skip
whenever you want to change the Edittext to visible at the time change the boolean value
no need to take boolean isneedValidation=false; working by putting this code if (firstName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) { return "Please Enter Your First Name"; }
– Shruti B
Nov 15 '18 at 14:18
add a comment |
Add boolean value
boolean isneedValidation=false;
else if (isneedValidation &&ComponentUtils.getInputStringFromView(selDoc).toString().isEmpty()) {
return "Please Enter Your Email ID";
}
if isneedValidation is true condition will check otherwise it will skip
whenever you want to change the Edittext to visible at the time change the boolean value
Add boolean value
boolean isneedValidation=false;
else if (isneedValidation &&ComponentUtils.getInputStringFromView(selDoc).toString().isEmpty()) {
return "Please Enter Your Email ID";
}
if isneedValidation is true condition will check otherwise it will skip
whenever you want to change the Edittext to visible at the time change the boolean value
answered Nov 15 '18 at 13:25
veerendranveerendran
364
364
no need to take boolean isneedValidation=false; working by putting this code if (firstName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) { return "Please Enter Your First Name"; }
– Shruti B
Nov 15 '18 at 14:18
add a comment |
no need to take boolean isneedValidation=false; working by putting this code if (firstName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) { return "Please Enter Your First Name"; }
– Shruti B
Nov 15 '18 at 14:18
no need to take boolean isneedValidation=false; working by putting this code if (firstName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) { return "Please Enter Your First Name"; }
– Shruti B
Nov 15 '18 at 14:18
no need to take boolean isneedValidation=false; working by putting this code if (firstName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) { return "Please Enter Your First Name"; }
– Shruti B
Nov 15 '18 at 14:18
add a comment |
This is the certain answer of your question.
private String validate() {
if (firstName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) {
return "Please Enter Your First Name";
}
else if (firstName.getVisibility() == View.VISIBLE && !Validator.isValidName(ComponentUtils.getInputStringFromView(firstName))) {
return "Please Enter Valid First Name";
}
else if (lastName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(lastName).toString().isEmpty()) {
return "Please Enter Your Last Name";
}
else if (lastName.getVisibility() == View.VISIBLE && !Validator.isValidName(ComponentUtils.getInputStringFromView(lastName))) {
return "Please Enter Valid Last Name";
}
else if (selDoc.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(selDoc).toString().isEmpty()) {
return "Please Select Doctor";
}
else if (reference.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(reference).toString().isEmpty()) {
return "Please Enter Reference Name";
}
else if (reference.getVisibility() == View.VISIBLE && !Validator.isValidReferenceName(ComponentUtils.getInputStringFromView(reference))) {
return "Please Enter Valid Reference Name";
}
else {
return "";
}
}
This answer is also what @user:5978440 tried to explain you.
– Murat Guc
Nov 15 '18 at 14:09
Thank you for your help. I have done with the same technique. It's working fine
– Shruti B
Nov 15 '18 at 14:23
add a comment |
This is the certain answer of your question.
private String validate() {
if (firstName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) {
return "Please Enter Your First Name";
}
else if (firstName.getVisibility() == View.VISIBLE && !Validator.isValidName(ComponentUtils.getInputStringFromView(firstName))) {
return "Please Enter Valid First Name";
}
else if (lastName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(lastName).toString().isEmpty()) {
return "Please Enter Your Last Name";
}
else if (lastName.getVisibility() == View.VISIBLE && !Validator.isValidName(ComponentUtils.getInputStringFromView(lastName))) {
return "Please Enter Valid Last Name";
}
else if (selDoc.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(selDoc).toString().isEmpty()) {
return "Please Select Doctor";
}
else if (reference.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(reference).toString().isEmpty()) {
return "Please Enter Reference Name";
}
else if (reference.getVisibility() == View.VISIBLE && !Validator.isValidReferenceName(ComponentUtils.getInputStringFromView(reference))) {
return "Please Enter Valid Reference Name";
}
else {
return "";
}
}
This answer is also what @user:5978440 tried to explain you.
– Murat Guc
Nov 15 '18 at 14:09
Thank you for your help. I have done with the same technique. It's working fine
– Shruti B
Nov 15 '18 at 14:23
add a comment |
This is the certain answer of your question.
private String validate() {
if (firstName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) {
return "Please Enter Your First Name";
}
else if (firstName.getVisibility() == View.VISIBLE && !Validator.isValidName(ComponentUtils.getInputStringFromView(firstName))) {
return "Please Enter Valid First Name";
}
else if (lastName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(lastName).toString().isEmpty()) {
return "Please Enter Your Last Name";
}
else if (lastName.getVisibility() == View.VISIBLE && !Validator.isValidName(ComponentUtils.getInputStringFromView(lastName))) {
return "Please Enter Valid Last Name";
}
else if (selDoc.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(selDoc).toString().isEmpty()) {
return "Please Select Doctor";
}
else if (reference.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(reference).toString().isEmpty()) {
return "Please Enter Reference Name";
}
else if (reference.getVisibility() == View.VISIBLE && !Validator.isValidReferenceName(ComponentUtils.getInputStringFromView(reference))) {
return "Please Enter Valid Reference Name";
}
else {
return "";
}
}
This is the certain answer of your question.
private String validate() {
if (firstName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(firstName).toString().isEmpty()) {
return "Please Enter Your First Name";
}
else if (firstName.getVisibility() == View.VISIBLE && !Validator.isValidName(ComponentUtils.getInputStringFromView(firstName))) {
return "Please Enter Valid First Name";
}
else if (lastName.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(lastName).toString().isEmpty()) {
return "Please Enter Your Last Name";
}
else if (lastName.getVisibility() == View.VISIBLE && !Validator.isValidName(ComponentUtils.getInputStringFromView(lastName))) {
return "Please Enter Valid Last Name";
}
else if (selDoc.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(selDoc).toString().isEmpty()) {
return "Please Select Doctor";
}
else if (reference.getVisibility() == View.VISIBLE && ComponentUtils.getInputStringFromView(reference).toString().isEmpty()) {
return "Please Enter Reference Name";
}
else if (reference.getVisibility() == View.VISIBLE && !Validator.isValidReferenceName(ComponentUtils.getInputStringFromView(reference))) {
return "Please Enter Valid Reference Name";
}
else {
return "";
}
}
answered Nov 15 '18 at 14:06
Murat GucMurat Guc
22227
22227
This answer is also what @user:5978440 tried to explain you.
– Murat Guc
Nov 15 '18 at 14:09
Thank you for your help. I have done with the same technique. It's working fine
– Shruti B
Nov 15 '18 at 14:23
add a comment |
This answer is also what @user:5978440 tried to explain you.
– Murat Guc
Nov 15 '18 at 14:09
Thank you for your help. I have done with the same technique. It's working fine
– Shruti B
Nov 15 '18 at 14:23
This answer is also what @user:5978440 tried to explain you.
– Murat Guc
Nov 15 '18 at 14:09
This answer is also what @user:5978440 tried to explain you.
– Murat Guc
Nov 15 '18 at 14:09
Thank you for your help. I have done with the same technique. It's working fine
– Shruti B
Nov 15 '18 at 14:23
Thank you for your help. I have done with the same technique. It's working fine
– Shruti B
Nov 15 '18 at 14:23
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53320208%2fenabling-or-disabling-validation-for-a-particular-edittextview-dynamically-thoug%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Yeah with invisible edittext you are able to get text from edittext. So you need to change visibility from
INVISIBLE
toGONE
.– Piyush
Nov 15 '18 at 13:20
did that way too. still, not working @Piyush
– Shruti B
Nov 15 '18 at 13:49