on submit not working as planned

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
Roo
Posts: 107
Joined: Tue Oct 24, 2017

15 Jan 2021

Hi I have a form that has two sign off fields in the form. each sign of field will have two gros in the people picker

Users will will only belong to one group.

The problem I'm getting is that when a user signs there part off it does not save as I think the form is looking for a value in the other people picker

Example

a user checking the techSO clicks the checkbox and their name and date will appear correctly. However when saving the form it does not save.

If I make the prodcmptby and prodsodate readonly true in the properties the user is able to save . However, I cant do this as I need them to be visible and usable.

is there a way I can check one of the check boxes and be able to save the form without having changed the other group?

Code: Select all

fd.field('Prodcmpltby').readonly(true);
fd.field('prodsodate').readonly(true);
fd.field('Techcmpltby').readonly(true);
fd.field('techsodate').readonly(true);

fd.field('ProdSO').change(function(){
	fd.field('Prodcmpltby').readonly(false);
	fd.field('prodsodate').readonly(false);
	
	if(fd.field('ProdSO').value()){
		fd.field('Prodcmpltby').value(_spPageContextInfo.userLoginName);
		fd.field('prodsodate').value(new Date());
	}
	else{
		fd.field('Prodcmpltby').value(null);
		fd.field('prodsodate').value(null);
	}
	
	fd.field('Prodcmpltby').readonly(true);
	fd.field('prodsodate').readonly(true);
});

fd.field('TechSo').change(function(){
	fd.field('Techcmpltby').readonly(false);
	fd.field('techsodate').readonly(false);
	
	if(fd.field('TechSo').value()){
		fd.field('Techcmpltby').value(_spPageContextInfo.userLoginName);
		fd.field('techsodate').value(new Date());
	}
	else{
		fd.field('Techcmpltby').value(null);
		fd.field('techsodate').value(null);
	}
	
	fd.field('Techcmpltby').readonly(true);
	fd.field('techsodate').readonly(true);
});

fd.onsubmit(function () {
  fd.field('prodsodate').readonly(false);
  fd.field('Prodcmpltby').readonly(false);
  fd.field('Techcmpltby').readonly(false);
  fd.field('techsodate').readonly(false);
  return true;
});
prob211.png
prob211.png (155.53 KiB) Viewed 8518 times

User avatar
Roo
Posts: 107
Joined: Tue Oct 24, 2017

18 Jan 2021

in addition to this - I guess what would fix it, is saying within the form submit section if (ie) the technical area is sign of is true then change the corresponding read only fields to false, otherwise dont?
Is that possible and would that get around the issue with none saving forms?

I've tried using this, but it seems to effect the js in the previous areas (the name and will not auto populate on click)

Code: Select all

fd.onsubmit(function () {
	if(fd.field('TechSo').value()){
  		fd.field('Techcmpltby').readonly(false);
  		fd.field('techsodate').readonly(false);
	}
	else{
  		fd.field('Techcmpltby').readonly(true);
  		fd.field('techsodate').readonly(true);
	}
	});

	if(fd.field('ProdSo').value()){
  		fd.field('prodsodate').readonly(false);
  		fd.field('Prodcmpltby').readonly(false);
	}
	else{
  		fd.field('prodsodate').readonly(true);
  		fd.field('Prodcmpltby').readonly(true);
	}
	});

  return true;
});

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

18 Jan 2021

Dear Roo,
I am not quite sure, but what exactly you want to achieve? Normally, all readonly fields should change to editable in onsubmit, or they will be emptied even if they had a value previously. So there should be no downside to using this, even if only one will have a value:

Code: Select all

fd.onsubmit(function () {
  fd.field('prodsodate').readonly(false);
  fd.field('Prodcmpltby').readonly(false);
  fd.field('Techcmpltby').readonly(false);
  fd.field('techsodate').readonly(false);
  return true;
});
What's the problem with saving though? Are you sure that none of these fields are set as required in List Settings?
Cheers

User avatar
Roo
Posts: 107
Joined: Tue Oct 24, 2017

18 Jan 2021

I was trying to use one form for mutiple sharepoint groups. Something was not working correctly so now I am using the multi form apprach as per my other post.

Thanks Nikita

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests