Hello, everyone. I have two questions involving the Flash Forms in CF7. 1. For the built in validation, the messages are coming up in mixed order. (ie, if the required fields are FirstName, LastName, Street, City, State, Zip, Phone, Email, the messages come up LastName, Email, City, State, Street, Zip, etc.) Is there a way to force the messages to appear in the same order as the form fields? 2. I'm using a tabnavigation form, and would like to add a button to the bottom of the first tab that, when clicked, will be the same as the user clicking on the second tab at the top of the form. How can this be done? Thank you, ^_^
Is there anyone even here? Three days without a response, kinda depressing.
1st problem try placing on the cfform tag onError="" this will supress the alert which is not really needed as the input boxes are surrounded by a red box anyway 2nd problem, ensure that the tabnav has an id param specified for example id="myTabNav" then on your button onClick="myTabNav.selectedIndex=1" selectedIndex="0" is the 1st tab selectedIndex="1" is the 2nd tab etc...
Second problem solution works, thanks for the suggestion. First problem solution, not an option, the client wants the alert. Is there a way to set order to the message for each form field? Thanks, ^_^
If the first problem cannot be resolved as requested, then is there anyone here who can either: a) Show me how I can get Flash forms to work with JavaScript, so I can do validation that way, or b) Show me how I can use actionscript (of which I have no knowledge) to do validation that way. Thanks, ^_^
Try this example found on Ray Camden's blog <cffunction name="checkFieldSet" output="false" returnType="string"> <cfargument name="fields" type="string" required="true" hint="Fields to search"> <cfargument name="form" type="string" required="true" hint="Name of the form"> <cfargument name="ascode" type="string" required="true" hint="Code to fire if all is good."> <cfset var vcode = ""> <cfset var f = ""> <cfsavecontent variable="vcode"> var ok = true; var msg = ""; <cfloop index="f" list="#arguments.fields#"> <cfoutput> if(!mx.validators.Validator.isValid(this, '#arguments.form#.#f#')) { msg += #f#.errorString + "\n"; ok = false; } </cfoutput> </cfloop> </cfsavecontent> <cfset vcode = vcode & "if(!ok) { mx.controls.Alert.buttonWidth=100; mx.controls.Alert.show(msg,'Error'); }"> <cfset vcode = vcode & "if(ok) #ascode#"> <cfset vcode = replaceList(vcode,"#chr(10)#,#chr(13)#,#chr(9)#",",,")> <cfreturn vcode> </cffunction> <cfform name="form1" format="flash" skin="haloblue" width="580" height="500" action="index.cfm" preservedata="yes"> <cfformgroup type="page"> <cfinput name="InsuranceName" type="text" label="Insurance Company Name:" width="150" required="yes" message="InsuranceName is Required." /> <cfinput name="PlanType" type="text" label="Plan Type:" width="150" required="yes" message="PlanType is Required." /> <cfinput name="PolicyNumber" type="text" label="Policy Number:" width="150" required="yes" message="PolicyNumber is Required." /> <cfinput name="GroupName" type="text" label="Group Name:" width="150" required="yes" message="GroupName is Required." /> <cfinput name="GroupNumber" type="text" label="Group Number:" width="150" required="yes" message="GroupNumber is Required." /> <cfinput name="Display" type="text" label="Display:" width="150" /> </cfformgroup> <cfinput type="button" name="step3b" value="Next" onClick="#checkFieldSet("PlanType,PolicyNumber,GroupName,GroupNumber","form1","P lanType.text=InsuranceName.text")#"> </cfform>
I'll give that a shot, Nick, and let you know if that did the trick. Meanwhile, I've got another problem that just popped up: I'm using CFFORMGROUP type="repeater" for creating checkboxes that all have the same name - but even if I put checked="no" or checked="false", ALL the checkboxes are checked when the page loads. Any idea how to turn them off? Thanks, ^_^
Can you please post a snippet of code, i cannot replicate this with a simple query and simple form
Sure thing, and thanks for taking the time to look at it. I don't have a lot of experience working with the Flash form stuff in CF7, and I appreciate the other set of eyes. Here's the CFFORM code: [b] <cfformgroup type="horizontal"> <cfformgroup type="repeater" query="expertiseList"><cfinput name="surv_expertise" type="checkbox" value="{expertiseList.currentItem.expertiseName}" tabindex="#tabIdx#" enabled="yes" visible="yes" label="{expertiseList.currentItem.expertiseName}" /><cfset tabIdx = tabIdx + 1></cfformgroup> </cfformgroup> [/b] The query returns the following (id is not currently used, just the name): [b] 1 Business & Labor 2 Education 3 Government 4 Science & Technology 5 Spiritual Communities 6 Arts 7 Communications and Media 8 Int'l. Intergovernmental Org. 9 Civil Society & NGO's [/b] Much appreciated. ^_^
Checkboxes with repeaters, we dont use the checked option but the value option the bound value option should be a Boolean expression, something that is already true/false in your code all the values are true so you always get a checkbox selected so for example this query in a repeater would always return true because we have a value in the checked field <cfset myQuery = querynew("ID, Name,checked")> <cfset newRow = QueryAddRow(MyQuery, 4)> <cfset temp = QuerySetCell(myQuery, "ID", "1", 1)> <cfset temp = QuerySetCell(myQuery, "Name", "Business & Labor", 1)> <cfset temp = QuerySetCell(myQuery, "checked", "true", 1)> <cfset temp = QuerySetCell(myQuery, "ID", "2", 2)> <cfset temp = QuerySetCell(myQuery, "Name", "Education", 2)> <cfset temp = QuerySetCell(myQuery, "checked", "false", 2)> <cfset temp = QuerySetCell(myQuery, "ID", "3", 3)> <cfset temp = QuerySetCell(myQuery, "Name", "Government", 3)> <cfset temp = QuerySetCell(myQuery, "checked", "true", 3)> <cfset temp = QuerySetCell(myQuery, "ID", "4", 4)> <cfset temp = QuerySetCell(myQuery, "Name", "Science & Technology", 4)> <cfset temp = QuerySetCell(myQuery, "checked", "false", 4)> <cfformgroup type="repeater" query="myQuery"> <cfinput type="checkbox" name="chkbx" label="{myQuery.currentItem.Name}" value="{myQuery.currentItem.checked}"> </cfformgroup> so to use the repeater then this would work <cfset myQuery = querynew("ID, Name,checked")> <cfset newRow = QueryAddRow(MyQuery, 4)> <cfset temp = QuerySetCell(myQuery, "ID", "1", 1)> <cfset temp = QuerySetCell(myQuery, "Name", "Business & Labor", 1)> <cfset temp = QuerySetCell(myQuery, "checked", "true", 1)> <cfset temp = QuerySetCell(myQuery, "ID", "2", 2)> <cfset temp = QuerySetCell(myQuery, "Name", "Education", 2)> <cfset temp = QuerySetCell(myQuery, "checked", "", 2)> <cfset temp = QuerySetCell(myQuery, "ID", "3", 3)> <cfset temp = QuerySetCell(myQuery, "Name", "Government", 3)> <cfset temp = QuerySetCell(myQuery, "checked", "true", 3)> <cfset temp = QuerySetCell(myQuery, "ID", "4", 4)> <cfset temp = QuerySetCell(myQuery, "Name", "Science & Technology", 4)> <cfset temp = QuerySetCell(myQuery, "checked", "", 4)> <cfformgroup type="repeater" query="myQuery"> <cfinput type="checkbox" name="chkbx" label="{myQuery.currentItem.Name}" value="{myQuery.currentItem.checked}"> </cfformgroup> if you dont want to use a repeater then using the first query above this would work cfoutput query="myQuery"> <cfinput type="Checkbox" name="chk_#ID#" label="#Name#" value="#ID#" checked="#checked#"> </cfoutput> But this method can have an overhead as repeating controls are generated by the ColdFusion server before creating the MXML and subsequent SWF file. When the data changes (and maybe every time the page is requested) the server must regenerate the MXML and recompile the SWF using the repeater The repeating controls are actually generated in ActionScript in the SWF file, not on the server, so when the data changes the SWF file doesn?t need to be recreated by the server Hope this helps --Nick
Don't see what you're looking for? Try a search.
|