Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryArticles template: file required is not optionalArticles template: file required is not optional
Previous
 
Next
New Post
7/19/2006 2:22 PM
 
Hi

In the form.xml of the Articles template:
<Token>[FILE]</Token>
  <Settings>
   <Setting>
    <Name>Required</Name>
    <Value>false</Value>
   </Setting>

But this does not seem to have any effect ?

DNN4.32 shared hosting Rep Mod is 03.01.10

Is there another way to turn this off ?

Thank you

Mutate and Survive
 
New Post
7/19/2006 11:26 PM
 

You could remove it from the template but then you won't be able to upload a file when you want to. I was talking to Steve the other day wondering if it was possible the version that gets installed with DNN might have been a build before he added the Required setting. He was going to check it out when he got some time.

 

 
New Post
7/20/2006 7:23 AM
 

Hi Mikeh

Thanks for that.   I can clone the template and have one that does and a version that does not. 

Thanks

Betacam 

 


Mutate and Survive
 
New Post
7/20/2006 8:57 AM
 
Hi again

I tried removing the reference but no change.  Given that the release version may not be correct I will watch this thread with interest.
This is a fantastic and useful template - just wish it did what it said it does.

Thanks all



Mutate and Survive
 
New Post
7/20/2006 1:57 PM
 

I'm pretty sure you have the latest version, if you didn't you wouldn't see the 'Required' setting in your form.xml file. However, to be sure, you could always download the module build directly from the Repository Project Downloads page and re-install it to make sure. I have checked out the download link on this page and it does indeed download the latest build that includes the "Required" setting parser.

Also, the .xml file is looked for in 2 places. Assuming you are using the 'articles' template, it will look in the "~/Portals/#/RepositoryTemplates/articles" folder first to look for the form.html and form.xml files. If it does not find them there, it will look in the "~/DesktopModules/Repository/Templates/articles" folder. So, make sure you don't have an articles folder under your Portal folder structure to make sure you're looking at the correct form.xml file.

A walkthrough of the code might help understand why your form is being generated with a required field validator for the [FILE] token...

When adding an item for the first time ( ItemId will be -1 ), the code looks in the form.xml file for the [FILE] token and looks at the "Required" setting. If the setting is not there, the default is "true". If the value is "true" then a validator control will be injected into the form.

So, there are 2 ways to get a validator, either the setting in the form.xml file for "[FILE] -> Required" is set to "true" or you do not have the "Required" setting at all. If the setting is anything other than "true" then no validator will be injected.

Case "FILE"
   Dim objFile As New HtmlControls.HtmlInputFile
   objFile.ID = "__File"
   PlaceHolder.Controls.Add(objFile)
   ' we're uploading a file for the first time ( ItemID=-1 ) then we need to insert
   ' a required field validator. If we're editing, we don't because leaving the field blank
   ' will leave the current file in place
   If objRepository.ItemId = -1 Then
      If oRepositoryBusinessController.GetSkinAttribute(xmlDoc, "FILE", "Required", "true") = "true" Then
         Dim oValidator As New RequiredFieldValidator
         oValidator.ControlToValidate = "__File"
         oValidator.CssClass = "normalred"
         oValidator.ErrorMessage = Localization.GetString("ValidateFile", oRepositoryBusinessController.LocalResourceFile)
         oValidator.ID = "__ValFileID"
         oValidator.Display = ValidatorDisplay.Static
         PlaceHolder.Controls.Add(oValidator)
      End If
   Else
      If objRepository.FileName <> "" Then
         PlaceHolder.Controls.Add(New LiteralControl("<br>"))
         Dim objLabel As New Label
         objLabel.Text = oRepositoryBusinessController.ExtractFileName(objRepository.FileName)
         objLabel.CssClass = oRepositoryBusinessController.GetSkinAttribute(xmlDoc, "FILE", "CssClass", "normal")
         PlaceHolder.Controls.Add(objLabel)
      End If
   End If

I will assume, that even after this, you will look at your server and say that everything looks fine, but that you are still getting a form where the file is required. Let me know and if necessary I can send you a special 'debugging' version of the Repository that will tell us more info and pinpoint the problem.

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryArticles template: file required is not optionalArticles template: file required is not optional


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out