Submitted by Lucian on Tue, 12/27/2016 - 11:10
Hello,
I am trying to create a conditional Yes/No custom field to use with my Nginx hack (issue https://www.virtualmin.com/node/45023 ), but I am noticing that the variable doesn't have a value when declared, regardless of whether Yes or No is used.
Eg I created a custom field called NginxStaticCaching of type Yes/No, default No. When the prepost hook script executes I can see there is a VIRTUALSERVER_FIELD_NGINXSTATICCACHING declared, but no value.
In fact, after the creation I tried to switch it from No to Yes in Edit Virtual Server, but when the page refreshes it still shows "No" as the chosen one.
Any ideas what's wrong?
Status:
Closed (fixed)
Comments
Submitted by JamieCameron on Tue, 12/27/2016 - 15:27 Comment #1
Which Virtualmin version are you running there? Because I recall that there used to be a bug that caused this problem, but we fixed it in the latest (5.05) release.
Submitted by Lucian on Wed, 12/28/2016 - 02:42 Comment #2
Jamie,
I'm on 5.05, this is a stock installation, just a few days old, for testing nginx and stuff. Nothing fancy,
Submitted by JamieCameron on Thu, 12/29/2016 - 01:02 Comment #3
Can you attach a screenshot of exactly what you entered on the Custom Fields page? I'd like to see how you have it setup..
Submitted by Lucian on Thu, 12/29/2016 - 03:23 Comment #4
Of course
http://storage7.static.itmages.com/i/16/1229/h_1483003389_7692715_4f4da7...
Submitted by JamieCameron on Fri, 12/30/2016 - 01:14 Comment #5
You need to enter something into the field to the right of the menu in which Yes/No is selected - that's the value that the variable will have when "Yes" is selected.
Submitted by Lucian on Fri, 12/30/2016 - 14:22 Comment #6
Ohh, thought it was a simple boolean... Thanks, that seems to have fixed it.
Happy new year!
Submitted by JamieCameron on Fri, 12/30/2016 - 19:08 Comment #7