Hide Fields and set fields required conditionally
-
- Posts: 9
- Joined: Mon Jun 02, 2014
- Contact:
Hello,
I have a couple of questions:
1. How to we HIDE fields dynamically, I was able to set Read Only but not hide.
2. titleRequired(value) only puts an asterisk but does not really validate on submit. How do we make controls required and validate them dynamically.
Apart from the javascript methods explained here 'http://spform.com/documentation/js/field' can we use other methods? If so can you please provide a sample.
Thanks
I have a couple of questions:
1. How to we HIDE fields dynamically, I was able to set Read Only but not hide.
2. titleRequired(value) only puts an asterisk but does not really validate on submit. How do we make controls required and validate them dynamically.
Apart from the javascript methods explained here 'http://spform.com/documentation/js/field' can we use other methods? If so can you please provide a sample.
Thanks
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hello,
1
You may assign a CSS-class to a field and use this class in JavaScript to hide the field:
You can also get the specific field by its internal name and hide it in a similar manner:
2
Please, add your custom validation code into onsubmit handler. Example:
1
You may assign a CSS-class to a field and use this class in JavaScript to hide the field:
Code: Select all
$('.your-class-name').hide().
Code: Select all
$('.fd_field[fd_name="InternalName"]').hide();
Please, add your custom validation code into onsubmit handler. Example:
Code: Select all
fd.onsubmit(function() {
if (!fd.field('Title').value()) {
alert('Please, fill in the Title field.');
return false;
}
return true;
});
-
- Posts: 9
- Joined: Mon Jun 02, 2014
- Contact:
Thanks Dmitry..It worked..these forms are looking very promising especially for SharePoint foundation users..
-
- Information
-
Who is online
Users browsing this forum: No registered users and 12 guests