In cfwheels if you have a hasMany relationship and you are using the hasmanycheckbox to display your checkboxes you might want to make sure that the user checks at least one of the checkboxes.
Here’s one way to do that. Here’s an example where we have a relationship where 1 Reservation can have have many TechnologySelections (which is then tied to table called Technologies which contains all the possible technologies that can be reserved).
—– Reserveration.cfc MODEL ——-
hasMany(name="TechnologySelections", shortcut="Technologies"); validate(method="ValidateTechSelections"); <cfif arrayIsEmpty(this.TechnologySelections)> <cfset addError(property="TechnologySelections", message="Please select at least one technology.") /> </cfif>
—– TechnologySelection.cfc MODEL ——-
belongsTo("Reservation"); belongsTo("Technology");
In the Reservation.cfc I’ve created a custom validation called ValidateTechSelections using the validate tag. Then I created the function to do this custom validation which checks the array this.TechnologySelections to see if it’s empty. If the array is empty then it sets the addError for the property TechnologySelections. CFWheels uses the name of the hasMany model for the array variable. You could also use the ColdFusion tag ArrayLen to get the length of the this.TechnologySelections array and validate it to be greater than 1 or between 2 values if you wanted.
I added a similar example to the validate documentation in the CFWheels framework on github so hopefully when/if that gets added to the cfwheels website it will help give another example right in the official documentation.
The RPC server is unavailable Sharepoint 2013 Preview Configuration Wizard Fails on Install
On step 3 of the Sharepoint 2013 Preview Configuration Wizard it would fail with the error:
The RPC server is unavailable
I then checked the log file and found the following:
Failed to create the configuration database.
Additional exception information: An error occurred while getting information about the user USERNAME at server DOMAINNAME: The RPC server is unavailable
Everyone on the web says the same thing: check the access rights to add DB’s on the SQL database, do you have proper access rights on the servers, do you have such and such ports open, is your RPC service running. I checked all of these and opened everything up…
BUT if you are like me you tried all those things and it still failed! Luckily, I realized the one stupid thing that I forgot…
Here’s my solution
Make sure you are logged onto the server where you are running the Configuration Wizard with a domain account, and to be safe, I ran the install with the same domain account that I want to run the Sharepoint services with.
I hope this helps save you the 8 hours of work I spent trying to figure this problem out.
Below I am changing the value of an input by using the id of the field using jquery
$('#MyFieldID').val('This is the new value');
The easiest way to limit the maximum length someone can type into a textarea field of your form is to do the following:
<textarea name=”mytextarea” id=”mytextarea” cols=”50″ rows=”4″ onkeypress=”return (this.value.length < 20);” >
Where 20 is the maximum number of characters you want to show. This seems to work well on Chrome and IE. I found a lot of other examples on the web that require 30 lines of code, but this is the simplest way, just using the onkeypress event.
onkeypress=”return (this.value.length < 20);”
DFS Location is not available – The network location cannot be reached – Can’t Open DFS Shared Folder – Windows 2008 Server
This is a frustrating error you might run into this error on Windows Vista and Windows 7 when you try to access a DFS linked shared folder. It says something like Network Location Unavailable, or Location is not available, or The network location cannot be reached on the different flavors of Windows.
Solution 1
Change your client computer to be on the same domain name as the server you’re trying to access. For example, if your server’s FQDN (domain name) is myserver.yakimadev.com and your clients computer is myclient.microsoft.com, then you will need to change your client to have the same DNS suffix as your server (yakimadev.com in this example). So change your computer to be myclient.yakimadev.com. This should solve the problem, unless you already have incorrect data in the “Append DNS Suffixs” in the TCP/IP settings. If this is the case, or you can’t change the DNS name of your client then you need to move to solution 2.
Solution 2
If you can’t do solution 1, or you already have suffixes, then you need to do the following:
- Open Networking Properties, one way to get there on Windows 7 is by clicking Start then typing “Network” in the search, and then right clicking on Network and selecting properties.
- Then click the link in the top left corner “Change Adapter Settings”
- Right click on your network adapter and select “Properties”
- Click on Internet Protocol Version 4 (TCP/IPv4) and then click on the Properties button
- Click on the Advanced button
- Click on the DNS tab
- Check the Radio button “Append these DNS suffixes (in order):”
- Click the Add button and add the suffix of your server. In the example I use in solution one, I have a server called myserver.yakimadev.com, so I would add an entry for “yakimadev.com” and move that to the top.

- Click on ok, and then ok, and then close
- Disconnect your mapping to your DFS if you are currently mapped, and then remap it.
- It should work at this point!
A little more explanation
I’m not a DFS expert nor am I a networking expert, but from what I can tell when you click on a DFS linked folder the DFS server returns the host name of the server that is sharing that folder. Your client receives the host name and tries to append the host name to the DNS suffix that it is using and fails if your server has a different DNS suffix than your client. This process happens if you have the radio button in the image above checked that says “Append primary connection specific DNS suffixes” and also have the checkbox under it checked. Once you change this to “Append these DNS suffixes” and type in the suffix of your server you client will then take the host name of the server and append it to the DNS suffix you provided and find the server correctly.
I have a form with 3 radio buttons:
<input id="Desktop" name="Usage" type="radio" value="Desktop" /> Desktop <input id="Laptop" name="Usage" type="radio" value="Laptop" /> Laptop <input id="iPad" name="Usage" type="radio" value="iPad" /> iPad
If one of the first two radio buttons are checked then I dynamically ask the user if they are using a PC or a MAC, which is a set of radio’s called MacOrPC. I want the PC/MAC question to be required only if the Desktop or Laptop radio buttons are checked. To do this, I think I figured out the syntax in the jQuery Validation Plugin. Here’s the rule syntax I used that seems to work using the ampersand:
rules: {
MacOrPC: {required: "#Desktop:checked" & "#Laptop:checked"}
}
I had a bunch of images on a webpage that had id’s that began with myimage and then had a number, like myimage1, myimage2, myimage3. I wanted to select them all and change the image. To do this you can use 1 line of the code:
$('img[id*=myimage]').attr("src", "/images/differentimg.jpg");
In this code you are telling jQuery to look for any img tags on your webpage that have the word myimage in their id and then change the src tag of the image to differentimg.jpg.
If you want to change the look and feel of error messages of the jquery validation plugin you need to set errorClass to the name of the class you want to use. So for example I wanted to change my error messages font color to be red so here is what I did in the head section of the webpage, I added a class called errors and then set the errorClass to be errors:
<style type="text/css">
.errors {color:#900};
</style>
<script type="text/javascript">
$(document).ready(function() {
$('#EventForm').validate({
errorClass:"errors",
rules: {
FirstName: {required: true}
}
});
});
</script>

