Required Fields Scenario
-
- Posts: 9
- Joined: Mon Jun 02, 2014
- Contact:
Hi..
I've a very common use case scenario where in the required fields should be bordered red and when users fill them and go to next field the border should be colored something else like black etc. This will let users know what fields they've missed to fill very easily when they submit. This is very intuitive.
So am using the onchange function for each required field to see if the field is empty or not.
1. I tried this fd.field('Is_x0020_ECN_x0020_Submitted').style('border:black'), but this did not work. Can you please tell me what is the correct syntax?
2. Can we write just one function to handle this and call this function from all 'onchange' functions of required fields?
Thank you..
I've a very common use case scenario where in the required fields should be bordered red and when users fill them and go to next field the border should be colored something else like black etc. This will let users know what fields they've missed to fill very easily when they submit. This is very intuitive.
So am using the onchange function for each required field to see if the field is empty or not.
1. I tried this fd.field('Is_x0020_ECN_x0020_Submitted').style('border:black'), but this did not work. Can you please tell me what is the correct syntax?
2. Can we write just one function to handle this and call this function from all 'onchange' functions of required fields?
Thank you..
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
1. Please, define the following classes in CSS-editor of Forms Designer:
Next, assign them via JavaScript following way:
2. Sure, just define JS-function and call it from each onchange handler.
Code: Select all
.black-border input[type="text"],
.black-border select,
.black-border textarea {
border: 1px solid Black;
}
.red-border input[type="text"],
.red-border select,
.red-border textarea {
border: 1px solid Red;
}
Code: Select all
//assign 'red-border' class
fd.field('ContentType').control()._el().removeClass('black-border').addClass('red-border');
//assign 'black-border' class
fd.field('ContentType').control()._el().removeClass('red-border').addClass('black-border');
-
- Posts: 9
- Joined: Mon Jun 02, 2014
- Contact:
Thanks Dmitry, these forms are really helpful!
-
- Information
-
Who is online
Users browsing this forum: No registered users and 16 guests