Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

includeScripts includes the stylesheet. These should be separate values. #1213

Open
markadrake opened this issue May 7, 2024 · 3 comments
Open

Comments

@markadrake
Copy link

markadrake commented May 7, 2024

When I set includeScripts to true I receive the following output:


<script defer="defer" src="/App_Plugins/UmbracoForms/Assets/themes/default/umbracoforms.min.js?v=13.1.2" type="application/javascript"></script>
<link href="/App_Plugins/UmbracoForms/Assets/themes/default/style.min.css?v=13.1.2" rel="stylesheet" />

I was unable to use includeScripts because it adds a stylesheet. I recommend these be separated in the future.

Edit: I'm also surprised that RenderUmbracoFormDependencies() does not render this script above.

@markadrake
Copy link
Author

It gets worse. If you disabled includeScripts you miss out on this:


<div class="umbraco-forms-form-config umbraco-forms-hidden"
--
  | data-id="be2ee399240a4a8994eadcb358cae10e"
  | data-serialized-page-button-conditions="{}"
  | data-serialized-fieldset-conditions="{}"
  | data-serialized-field-conditions="{&quot;4180564a-1753-4a39-9705-956a17a11d45&quot;:{&quot;id&quot;:&quot;293963b7-f02c-48e2-a614-d08b4829c553&quot;,&quot;actionType&quot;:&quot;Show&quot;,&quot;logicType&quot;:&quot;Any&quot;,&quot;rules&quot;:[{&quot;id&quot;:&quot;242f62f8-67d3-41c0-fdbd-285f42b383cc&quot;,&quot;fieldsetId&quot;:&quot;39801605-643c-47ab-8346-f4ea7678c74c&quot;,&quot;field&quot;:&quot;242f62f8-67d3-41c0-fdbd-285f42b383cc&quot;,&quot;operator&quot;:&quot;ContainsIgnoreCase&quot;,&quot;value&quot;:&quot;Other&quot;}]}}"
  | data-serialized-fields-not-displayed="{}"
  | data-trigger-conditions-check-on="change"
  | data-form-element-html-id-prefix=""
  | data-disable-validation-dependency-check="false"></div>

Which adds all the necessary functionality.

@markadrake
Copy link
Author

I can't set Html.SetFormThemeCssFile to null.

@AndyButland
Copy link

If you set includeScripts to false you need to take additional steps to render your scripts and config, usually at the end of the page. There's some details on how to do that here.

You can disable the stylesheet via form settings. Maybe it would be useful if you could separately control these via code, but you have this option:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants