Boolean and Multi line text
I need help with some boolean variable.
I would like to query for edit for if a boolean field is Yes or No.
If Yes, then set some fields to read only. I have done something like the following but still not working for me
var fieldName = fd.field('booleanField').value();
if (fieldName == 1){
fd.field('readOnlyField1').readonly(true);
fd.field('readOnlyField2').readonly(true);
}
The second question is I have a Enhanced rich text field that I also need to query on submit to make sure it is not empty. If the field is empty then I alert the user to make sure the field is not empty.
fd.onsubmit(function() {
var resolution = fd.field('Resolution').value();
if (resolution == '' && status == 'Completed') {
if (!fd.field(resolution).value()) {
alert('Resolution cannot be empty');
return false;
}
}
return true;
});
The resolution field is the enhanced rich text and this is not working for me.
Thanks for your help
I would like to query for edit for if a boolean field is Yes or No.
If Yes, then set some fields to read only. I have done something like the following but still not working for me
var fieldName = fd.field('booleanField').value();
if (fieldName == 1){
fd.field('readOnlyField1').readonly(true);
fd.field('readOnlyField2').readonly(true);
}
The second question is I have a Enhanced rich text field that I also need to query on submit to make sure it is not empty. If the field is empty then I alert the user to make sure the field is not empty.
fd.onsubmit(function() {
var resolution = fd.field('Resolution').value();
if (resolution == '' && status == 'Completed') {
if (!fd.field(resolution).value()) {
alert('Resolution cannot be empty');
return false;
}
}
return true;
});
The resolution field is the enhanced rich text and this is not working for me.
Thanks for your help
I got the second question to work but then it stops working. Here is what I did
var status = fd.field('TaskStatus').value();
if (!fd.field('Resolution').control()._el().find('div.ms-rtestate-write').text().trim() && status = 'Completed') {
alert('Resolution is empty');
}
What am I doing wrong here? It did work and somehow it stopped working.
Thank you.
var status = fd.field('TaskStatus').value();
if (!fd.field('Resolution').control()._el().find('div.ms-rtestate-write').text().trim() && status = 'Completed') {
alert('Resolution is empty');
}
What am I doing wrong here? It did work and somehow it stopped working.
Thank you.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi!
A comparison operator is ==. So if you want to compare status variable with a value, use status == 'Completed'.
A comparison operator is ==. So if you want to compare status variable with a value, use status == 'Completed'.
Sorry I had the operator correct. I miss type it in this question I asked.
Here is what I have but still not working
var status = fd.field('TaskStatus').value();
if (!fd.field('Resolution').control()._el().find('div.ms-rtestate-write').text().trim() && status == 'Completed') {
alert('Resolution field is empty');
return false;
}
Also, as part of my question can you also help with this if possible?
I need help with some boolean variable.
I would like to query for edit for if a boolean field is Yes or No.
If Yes, then set some fields to read only. I have done something like the following but still not working for me
var fieldName = fd.field('booleanField').value();
if (fieldName == 1){
fd.field('readOnlyField1').readonly(true);
fd.field('readOnlyField2').readonly(true);
}
Here is what I have but still not working
var status = fd.field('TaskStatus').value();
if (!fd.field('Resolution').control()._el().find('div.ms-rtestate-write').text().trim() && status == 'Completed') {
alert('Resolution field is empty');
return false;
}
Also, as part of my question can you also help with this if possible?
I need help with some boolean variable.
I would like to query for edit for if a boolean field is Yes or No.
If Yes, then set some fields to read only. I have done something like the following but still not working for me
var fieldName = fd.field('booleanField').value();
if (fieldName == 1){
fd.field('readOnlyField1').readonly(true);
fd.field('readOnlyField2').readonly(true);
}
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Just try to trace field values by outputting them either into the browser console or in a message box. Here is a sample:
Thus you will understand what value a field currently contains and will be able to compare it with the appropriate value.
Code: Select all
alert(fd.field('booleanField').value())
-
- Information
-
Who is online
Users browsing this forum: No registered users and 7 guests