Forum Replies Created
-
AuthorPosts
-
February 1, 2024 at 22:37 in reply to: Can I have an example of calling a jscript function from a rule #37451
Yes
February 1, 2024 at 16:31 in reply to: Can I have an example of calling a jscript function from a rule #37449Did you use the dffs_fieldChanged function from the Custom JS example thread?
You should be able to do it something like this:
function dffs_fieldChanged(fin, new_value, previous_value) { switch (fin) { case "fieldA": setFieldValue("fieldB", new_value.substring(0, 10)); // 10 first characters of fieldA is written to fieldB break; case "fieldC": setFieldValue("fieldD", new_value.substring(0, 10)); // 10 first characters of fieldA is written to fieldB break; } }
Alexander
Hi,
I’ll have to test this and see if I can replicate it. Can you email me screenshots of the setup and the error so I can set up a similar test?Alexander
I’m planning a new version hopefully over the weekend, but I’m not sure if I’ll be ale to get this one in that release – I’ll see what I can manage. If not, it should be fixed in a week or two.
Lists already work as the form is the primary input so you fill in the form and save.
Alexander
This is not an option in the current version, but I’ll look at adding that functionality in a future version.
Alexander
I’m planning to release a new version during or over the upcoming weekend.
Alexander
Thanks, I think this helped. I’ll include a fix in the next release.
Best regards,
AlexanderGood idea, I’ll look into it for the next version.
Alexander
It must be a permissions problem. I’m actually not 100% sure, but you might have to be a site collection admin to be able to list all subsites.
What you can do if this is a problem is to install the Charts solution in the subsite your coworker is trying to access.
Alexander
There is unfortunately no function to block the selection of the dates, but you can run a validation after the user has picked the date by adding some custom js and a rule.
Add this to your custom js:
function validateDateField() { var dateFieldInternalName = "DateColumn1"; jQuery(".customDateValidation").remove(); var today = new Date(); var date = spjs.utility.getDateFieldAsDateObject(dateFieldInternalName); var requiredDateOffset = 6; var diffDays = (date - today) / (24*60*60*1000); if (diffDays < requiredDateOffset) { jQuery("#dffs_"+dateFieldInternalName+" td.ms-formbody").append("<div class='customDateValidation' style='color:red;'>The date must be atleast <strong>"+requiredDateOffset+"</strong> in the future.</div>"); jQuery("#dffs_"+dateFieldInternalName+" input").val(""); } }
Change “DateColumn1” to match your date field internal name.
Now add a rule that triggers on “is changed” on your date field and add the name of the function to the “Run these functions / evaluate these rules” field like this:
validateDateField
When a selection is made in the field, this code checks if the value selected is 6 days in the future and shows a message and clears the value if it is not at least 6 days ahead.
Alexander
- This reply was modified 11 months ago by Alexander Bautz. Reason: Fixed code snippet format
I’ll fix this in the next version.
Alexander
NewForm and EditForm configurations are often different to let the first person use a simple form and then have a more complex form with more fields in editform.
I think the best solution would be to add an option to turn off quick save (I’ll look at adding that to the next version) so you can use the dffs_PostSaveAction custom js function to redirect to the EditForm configuration.
Alexander
Hi,
If you look at this thread and find the Do something before the item is saved section you can just use getFieldValue(“Your_field_name”) to get the value to build your new variable with the changes, and setFieldValue(“Your_field_name”, your_variable); to write it back to the field.Alexander
I haven’t seen this error myself. It refers to the built in object _spPageContextInfo and it tries to read the pageListId from that object.
If you are able to recreate the issue it would help me to troubleshoot if you could bring up the developer tools and type this in the console and send me the output (expand the object) by clicking the triangle to the left of the output:
_spPageContextInfo
Alexander
No worries, the Modern DFFS is a SharePoint framework app.
Alexander
-
AuthorPosts