How to define template suggestions for node add and edit form by content type?

I have a content type Project and it has a more than 100 fields in the node form. The form fields are grouped in different section and category. I tried to use a field_group module to group and categories in different sections, but when I add more than 20 groups field I got a problem in field arrangement and save the changes in form display. Also, i am facing difficulty to theme the form as per the design.

So, is it possible to define template suggestions for node add and edit form by content type and add an individual form element in the form template, where I can define my own HTML structure?

Eg: from–project.html.twig some things like this, and able to add individual form elements in the form template.

<form{{ attributes }}>  {{ form.title }}  {{ form.field_project_description }} </form> 

Thanks for any help.

Is there a way to get CSOM ClientContext by having cookies and a Form Digest?

I have been trying to do an interesting proof-of-concept/experiment

  1. Get SharePoint user’s cookies from the browser
  2. Pass these cookies to an Azure Function
  3. By having cookies only – determine who the user is (+)
  4. Run GET/POST REST queries using user’s permissions (+)
  5. Run C#/CSOM code using user’s permissions (-)

This might be a very nice approach that works very well without the need for some nasty adal.js+iframe solutions that only work with Graph API and don’t work with Azure functions.

So, basically, I’m stuck with the last task #5. I have cookies and I have FormDigest, but I don’t know how to get CSOM ClientContext using this information. Is it even possible? Can someone, please help me with it? I will be really obliged for any tips.

I’m including a working code below. You can insert your own cookies there to try it out.

class Program {     static void Main(string[] args)     {         AsyncMain(args);         Console.ReadKey(false);     }      static async void AsyncMain(string[] args)     {         string baseurl = "";         string rtFa = "REUSED_RtFA_Cookie";         string fedAuth = "REUSED_fedAUTH_COOKIE";          var digest = await GetDigest(baseurl, rtFa, fedAuth);          var baseAddress = new Uri(baseurl);         var cookieContainer = new CookieContainer();         using (var handler = new HttpClientHandler() { CookieContainer = cookieContainer })         using (var client = new HttpClient(handler) { BaseAddress = baseAddress })         {             client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));             client.DefaultRequestHeaders.Add("X-RequestDigest", digest);              cookieContainer.Add(baseAddress, new Cookie("rtFa", rtFa));             cookieContainer.Add(baseAddress, new Cookie("FedAuth", fedAuth));              StringContent bodyContent = new StringContent("{\"__metadata\":{\"type\":\"SP.Data.ArtefactsListItem\"},\"Title\":\"NEW VALUE2\"}");             bodyContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json;odata=verbose");             var result = client.PostAsync("/_api/web/Lists/getByTitle('Artefacts')/items", bodyContent).Result;             var contents = await result.Content.ReadAsStringAsync();             result.EnsureSuccessStatusCode();             Console.WriteLine("SharePoint List Item Created using REST");         }          // TODO: Awesome! We can do REST calls using user's cookies, but it's much easier if we could somehow do it using CSOM. How do we get ClientContext from cookies and a Form Digest?         using (var context = new ClientContext(baseurl))         {             // TODO: I want get SPContext having user's cookies and Form Digest:             context.Credentials = new SharePointOnlineCredentials("", new System.Security.SecureString());             context.Load(context.Web, web => web.Title);             context.ExecuteQuery();             Console.WriteLine("Your site title is: " + context.Web.Title);         }     }      static async Task<string> GetDigest(string baseUrl, string rtFa, string FedAuth)     {         var baseAddress = new Uri(baseUrl);         var cookieContainer = new CookieContainer();         using (var handler = new HttpClientHandler() { CookieContainer = cookieContainer })         using (var client = new HttpClient(handler) { BaseAddress = baseAddress })         {             client.DefaultRequestHeaders.Add("Accept", "application/json; odata=verbose");             cookieContainer.Add(baseAddress, new Cookie("rtFa", rtFa));             cookieContainer.Add(baseAddress, new Cookie("FedAuth", FedAuth));              var bodyContent = new StringContent("", Encoding.UTF8, "application/json");             var result = client.PostAsync(baseUrl+ "/_api/contextinfo", bodyContent).Result;             var contents = await result.Content.ReadAsStringAsync();               result.EnsureSuccessStatusCode();             dynamic response = JsonConvert.DeserializeObject(contents);             dynamic d = response.d;             string digest = d.GetContextWebInformation.FormDigestValue;              return digest;         }     } } 

Multiple choice lookup field does not render on edit form

I have, for the last few years, used a field called “Enabled” and a calculated field which returns the value of the Title field if Enabled is true. If Enabled is false, I return an empty string (“”). This is the formula: =IF([Enabled],[Title],””)

This allows the administrators of the site to temporarily enable/disable options from displaying in the new and edit form of a list which references those items in a multiple-choice lookup column with out-of-the-box functionality instead of using code. This has worked for many years, but all of a sudden, after the user-facing list (not the lookup list) has had thousands and thousands of items, this is causing issues.

On the display form, the disabled items in a lookup field used to not appear while the enabled items would still show. Now, the disabled items are displayed as numbers showing the corresponding lookup ID.

On the edit form, if a user had previously selected an item in a lookup and that item has now been disabled (blank), the item would fall off the list of selected results and not be available in the list of selections. Now, the entire selection candidate and results for the lookup field are not rendered. I inspected the HTML for the form, and there is literally nothing on that row other than the initial table cell with the field name.

This type of functionality (blanking out a field used in a lookup selection in order to hide it) still works on other lists and other sites. How can I narrow down what it suddenly causing this issue on this one list?

Self-updating form without submit button causes confusion

I’ve made a form that, when a form element changes, a search query is fired and the result is displayed by animating the big number in the middle. For one reason the number doesn’t always change, and for another, users of this app don’t always seem to notice the change, even though the animation of the number ticking up takes 1-2 seconds.

This led to users accidentally hitting the reset button after filling out the form because it was located at the bottom right and was colored gray. Moving the reset button and coloring it red made this work better. Alternatively, one could make an “Update” button at the bottom, but since the form delivers results continuously, it wouldn’t do much.

Are there any other UX tricks that may improve the experience of continuously receiving results? The result isn’t as apparent as when the entire page refreshes with a list of search results, but rather, just an animated number.

One thought is to add an information box when a search query is refined but the result is not updated. Otherwise it seems that the form did not respond. Another thought is some kind of “loading” animation. Another thought is to add an “Update” button, but I don’t know if it should simply trigger the re-animation of the already found result, or display the information box in case the number is the same.

The site is live here in case the screenshot is not tangible enough to review.

Self-updating form without submit button

show addres filds in new form magento 2

i have created a new form registration for customer and i want to show the address filds in the form i tried this code but nothing displayed. customer_account_create.xml :

<referenceBlock name="customer_form_register">         <action method="setShowAddressFields">             <argument name="show.address.fields" xsi:type="boolean">true</argument>         </action>     </referenceBlock> 

and when i replaced the if getshow address in my register2.phtml to setShowaddress(true) it tell me call getFrontalLabel() on null so how to show the address field and wha’s wrong with my code and thanks in advance