Advertisement

07.05.2008 at 12:14PM PDT, ID: 23540938
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.4

CFFORM checkbox validation with ActionScript

Asked by wwp_it in ActionScript, ColdFusion Application Server, Cold Fusion Markup Language

Tags: ,

I am developing a form for my teachers on staff to add assignments into a database. The end product will be a web application for students to submit papers in PDF format to their teachers. The web application interfaces with our student management system as well as our webserver (IIS, 6.0, Coldfusion MX7) and Fileserver (Windows 2003)

I have chosen to use <cfform format="flash"> for a number of reasons. I know I should be using FLEX, but don't have the time to figure out a new product/language. I have been struggling with this for hours on end.

The issue I am having is form validation. I need to ensure that the teachers check off at least one of their classes before submitting their assignment. Since the checkboxes and their names are generated dynamically, I need to validate a certain number of classes which is not constant. If no checkboxes for the classes have been checked, I need an alert box to pop up and form submission to be stopped.

All the research I have done online states that if I use FLASH format, the validation must be done in ACTIONSCRIPT, not JAVASCRIPT. I am unfamiliar with AS and only slightly familiar with JS. I am knowledgeable with ColdFusion.

The material I read online about JS validation stated that it could be done by the (cf)form input's ID attribute rather than the name. I named all of the input's ID attibutes the same, but the actual input names are dynamic.

When I add the onSubmit="#verify#" into the <cfform> tag, the form doesn't build. I have toyed with the syntax and can't seem to get it correct.

The SaveContent area above the form was an ActionScript attempt I pulled from Ray Camden's website. Not sure if my modified code is the issue there or not. I have also read on Adobe's site, here at experts-exchange, as well as other sites that the Java validation within Flash forms executes before the <cfform onsubmit=""> attribute. If that is the case, validation by actionscript should be wholly possible? no?

I am a teacher and web application programming is not my primary job, so please excuse my knowledge level. I appreciate any help you can offer.  Thanks!

-WWP_IT (Allan)

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
<cfsavecontent variable="verify">
	var checkSelected = false;
	var checkboxid;
	checkboxid = document.getElementById('classcheckbox');
	for (i = 0;  i < updateassignmentform.checkboxid.length;  i++){
	  	if (updateassignmentform.checkboxid[i].checked){
			checkSelected = true;
	  }
	}
    if (!checkSelected){
	  	mx.controls.Alert.show('At least one checkbox must be selected!','Error');
   		return false;
	}
	else {
               return true;
      }
</cfsavecontent>
 
<cfform action="updateassignment.cfm" name="updateassignmentform" id="updateassignmentform" preloader="yes" format="flash" style="backgroundAlpha: 0;" wmode="transparent" skin="haloblue" height="400" width="700" onSubmit="#verify#">
    <cfformgroup type="vertical">
        <cfinput name="name" label="Assignment Name" type="text" width="150">
        <cftextarea name="description" label="Assignment Description" cols="54" rows="3" wrap="virtual"></cftextarea>
    </cfformgroup>
    <cfformitem type="hrule"></cfformitem>
    <cfformgroup type="vertical">
    <cfinput name="assigndate" label="Assigned Date" type="datefield" width="150">
    </cfformgroup>
    <cfformitem type="hrule"></cfformitem>
    <cfinput name="duedate" label="Due Date" type="datefield" width="150">
    <cfformitem type="hrule"></cfformitem>
    <cfformgroup type="vertical" label="Classes To Post">
        <cfloop index="i" from="1" to="#TeacherClassListing.recordcount#">
            <cfinput type="Checkbox" name="S#TeacherClassListing.SectionID[i]#" id="classcheckbox" Label="#TeacherClassListing.name[i]# #TeacherClassListing.number[i]#-#TeacherClassListing.sectionnumber[i]#">
        </cfloop>
    </cfformgroup>
    <cfformitem type="hrule"></cfformitem>
    <cfformgroup type="vertical" label="Options">
        <cfinput type="checkbox" name="AllowUpload" label="Allow File Upload">
        <cfinput type="checkbox" name="DCActive" label="Activate In Digital Classroom">
    </cfformgroup>
    <cfformitem type="hrule"></cfformitem>
    <cfinput type="hidden" name="mode" value="#url.mode#">
    <cfinput type="submit" name="SubmitUpdate" value="Update">
</cfform>
[+][-]07.06.2008 at 08:12PM PDT, ID: 21942580

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: ActionScript, ColdFusion Application Server, Cold Fusion Markup Language
Tags: Actionscript, Coldfusion, Firefox, IE7
Sign Up Now!
Solution Provided By: wwp_it
Participating Experts: 0
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628