Forum Replies Created
-
AuthorPosts
-
July 6, 2018 at 18:01 in reply to: display lookup sub-field info on newform for read only use #21385
When using the above to show number fields on another list, the numbers show 14 points past the decimal (54.00000000000000)… however these columns are limited to 2 places past the decimal on the source list. Is there a way to limit the points past the decimal showing?
Attachments:
The instructions were from an old PDF a co-worker had: SPJSBlog.com
DFFS: JSLink Configuring DFFS with JSLink on SP2013 Alexander Bautz July 06, 2015I will give the recommended method a try, thanks.
you nailed it… thank you!!! we did not put that in there but that was the problem… client must have been playing around.
Thanks!
I want to use this to hide blank multi-line text fields in an Edit form. I think I need some code to go in the “()” after function in the JS script that sets the condition for triggering this rule as “is not equal to [blank]”… is that correct? if so can you give me the code for that?
Is this still the case? Have you looked into using the Graph API for this?
Sorry… I was tripping… there is not any js in that field… still curious about the line #1 there… have not seen that before.
I’m not used to seeing the line number “1” on this screen. Is that new to this particular version? I compared with other client sites and do not see this format elsewhere.
I have a few issues coming up on this specific code, and a few that are loosely related:
1) the sum calculation is not working on the display form using the same code above… do I need a modified version for the display form? Or should I have a “display allocation TL” column that is getting it’s value from the “Cost_x0020_Allocation_x0020_TL”, then replace the Cost Allocation TL field on the display form with the Display allocation TL field?
2) I notice that when fields are set as read only in DFFS rules that their number formatting and descriptions are removed. For example, I have a currency field that displays as: $4,000.00 with a description that says “Sum of X & Y”. When this field is set as read only on the edit or display form the description is removed and the number shows as 4000.00. Anyway to keep the description and the formatting in read only?
Thanks as always!!
This is a great start… I have not tested it yet, but hope to incorporate it into a customization soon. Thanks!!!
That works GREAT!!
nice tip on the field names… if only I got to create them from the start most of the time… still a great idea!!
This is FANTASTIC!
2 minor tweaks if I may impose…
1) Can the sum live update into a field please? field internal name: Cost_x0020_Allocation_x0020_TL
2) Can the Red text only appear under the Sum field in #1 above
Here is the modified js I am using:
function customCalculate(){
$(“.custom_calc_err”).remove();
var c1, c2, c3, tot, min = 100, max = 100;
c1 = getFieldValue(“East”);
c2 = getFieldValue(“West”);
c3 = getFieldValue(“USA”);
// verify number input
c1 = isNaN(Number(c1)) ? 0 : Number(c1);
c2 = isNaN(Number(c2)) ? 0 : Number(c2);
c3 = isNaN(Number(c3)) ? 0 : Number(c3);
tot = c1+c2+c3;
if(tot < min || tot > max){
spjs.dffs.toggleSaveBtnByRule(false);
$(“#dffs_East td:last, #dffs_West td:last, #dffs_USA td:last”).append(“<div class=’custom_calc_err’ style=’color:red;’>The sum of East, West and USA is “+tot+”. This is out of range (min=”+min+” and max=”+max+”)</div>”);
}else{
spjs.dffs.toggleSaveBtnByRule(true);
}
}// Trigger on change
$(“#dffs_East input, #dffs_West input, #dffs_USA input”).on(“change”,function(){
customCalculate();
});// Trigger on load
customCalculate();That is a cool feature and I like that for some other situations… this customer wants to be able to choose either the vendor name OR the vendor code and have the other field auto populate. As I describe in my post I do not expect to have both vLookups populate… thus I have created substitute fields.
So when a user chooses either vendor name or vendor code in the vLookup fields the JS retrieve value will populate the substitute field for the other vLookup. Then rules can show/hide the appropriate fields and even populate the other substitute field.
Thanks!!
I have tried to set this up and I am not seeing the results I expect:
Desired Results: I am trying to create a bidirectional lookup for Vender Name and Vendor Number. In the new item form I have a lookup column for each (name and number). I want the user to be able to use either of these and for the value to be populated in the other. So if I choose Acme Inc in the Vendor Name lookup, I want the Vendor Code field to show the corresponding vendor code; Acme123.
To do this I expect to have to have a single line text column for each of these columns when I use the “retrive value” js for the value to be reported in. So my lookups are VendorName (no space) and my single line of text columns are Vendor Name (with a space).
When the user chooses the VendorName from the lookup on the form, DFFS rule will hide the VendorCode (lookup) and show the Vendor Code (text) on form change. The Vendor Code field will be populated by the js.
Then vise versa would be true… if user choose the VendorCode lookup, the js would populate the Vendor Name text field, DFFS would hide the VendorName Lookup and show the Vendor Name test field.
What I have created:
– a lookup column to VendorName with a sub-lookup to VenderCode (working fine)
– a lookup column to VendorCode with a sub-lookup to VendorName (working fine)
– Single line of text columns for Vendor Code and Vendor Name (working fine)
– DFFS rules to show & Hide fields on lookup field change (working fine)
– These are the field names according to the Field table tab:
Vendor Code Vendor_x0020_Code SPFieldText
Vendor Name Vendor_x0020_Name0 SPFieldText
VendorCode VendorCode0 SPFieldLookup
VendorName VendorName0 SPFieldLookup
– I have put the following in the Custom JS tab:function getLookupExtraFieldValue(){
var val = do_getLookupExtraFieldValue();
alert(val);
}function do_getLookupExtraFieldValue(){
var data, lookupValue, b;
data = spjs.utility.getItemByID({“Purchase%20Request”:_spPageContextInfo.pageListId,”id”:spjs.dffs.data.thisItemID,”viewFields”:[“VendorName0”]});
lookupValue = data[“VendorCode0″];
if(lookupValue !== null){
return lookupValue;
setFieldValue(” Vendor_x0020_Code”,val);
}
}I’m not sure I put the below line you suggested to set the value in the JS correctly above (as the last line of the script).
setFieldValue(“FieldNameToSet”,val);
– I set up a DFFS Rule as follows:
Rule friendly name:
Vendor Code from VendorNameIf this trigger:
Custom JavaScript Function
no operatorThis Value:
getLookupExtraFieldValueValidate on:
Form Load and field changeIssue: I am not seeing the Vendor Code field populate when the Vendor name is set. Note I am only trying to set this up one direction for now, ie; user selects VendorName lookup then Vendor Code is populated by JS.
Once that works I will set it up for the opposite direction.
-
AuthorPosts