Re: Javascript Validation Coldfusion ?
Hi I have just tried all your suggestions shown below and it is still not working? The javascript validation kicks in for the two input fields and displays Title of the Uploaded File but the two select boxes did not activate the validation messages? Any ideas why?, I have attached the code snippet below that I am using. --- SCRIPT LANGUAGE=JavaScript !-- Begin function checkFields() { missinginfo = ; if (document.form.dltitle.value == ) { missinginfo += \n - Title of the File Uploaded; } if (document.form.dlsummary.value == ) { missinginfo += \n - Descriptive Summary of Uploaded File; } if(document.form.area.value == 1){ missinginfo += \n - Please select option for Sel1; } if(document.form.dlos.value == 1){ missinginfo += \n - Please select option for Sel2; } if (missinginfo != ) { missinginfo = ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Javascript Validation Coldfusion ?
Can you show me what your form looks like? I have a suspicion that your problem may lie there. In order for my code to work, you have to make sure that at least one of your options for your select is equal to one and that it is a value that you do not want them to be using. Also, on my demo, I went ahead and gave my form a name, such as TestForm and then called it specifically in my code such as document.TestDemo.[selectfeildname].value Hope this helps Larry Juncker Cold Fusion developer -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, August 17, 2001 3:56 AM To: CF-Talk Subject: Re: Javascript Validation Coldfusion ? Hi I have just tried all your suggestions shown below and it is still not working? The javascript validation kicks in for the two input fields and displays Title of the Uploaded File but the two select boxes did not activate the validation messages? Any ideas why?, I have attached the code snippet below that I am using. --- SCRIPT LANGUAGE=JavaScript !-- Begin function checkFields() { missinginfo = ; if (document.form.dltitle.value == ) { missinginfo += \n - Title of the File Uploaded; } if (document.form.dlsummary.value == ) { missinginfo += \n - Descriptive Summary of Uploaded File; } if(document.form.area.value == 1){ missinginfo += \n - Please select option for Sel1; } if(document.form.dlos.value == 1){ missinginfo += \n - Please select option for Sel2; } if (missinginfo != ) { missinginfo = ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Javascript Validation Coldfusion ?
First I recommend you send a blank email to [EMAIL PROTECTED] and join JS-Jive, the javascript list. You'll get lots of help with Javascript. But to answer your question, you need to access the selectedIndex property of a select box to validate it script function validateSelect(){ if (document.form.fieldname[selectedIndex].value == ){ alert(Please select an option in the select box.); return false; } } /script onsubmit=return validateSelect() This assumes that you have an option in the select box with an empty value... option value=(select option) HTH, Steve [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi How do you add validation to drop down form select boxes using Javascript. I have added validation (shown below in the js) for the two text input fields but need to build in validation for the two select boxes and also a CFFile field as these are required fields in the form, any ideas on how to integrate this into what I have below? SCRIPT LANGUAGE=JavaScript !-- Begin function checkFields() { missinginfo = ; if (document.form.filename.value == ) { missinginfo += \n - Title of the File Uploaded; } if (document.form.filesummary.value == ) { missinginfo += \n - Descriptive Summary of Uploaded File; } if (missinginfo != ) { missinginfo = ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Javascript Validation Coldfusion ?
I tend to place the js in the action page, assuming the dropdown is in a form. This is what I use to force someone to select a value from a prefix field. CFIF parameterexists(FORM.NAME_PREFIX) IS no or #trim(FORM.PREFIX)# is '' SCRIPT Language=JavaScript alert(Please Select a Prefix); history.back(); /SCRIPT CFABORT JoAnn A. Schlosser Senior Consultant Association Management Software Grant Thornton LLP Washington, D. C. 703.837.4428 This e-mail is intended solely for the person or entity to which it is addressed and may contain confidential and/or privileged information. Any review, dissemination, copying, printing or other use of this e-mail by persons or entities other than the addressee is prohibited. If you have received this e-mail in error, please contact the sender immediately and delete the material from any computer. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Javascript Validation Coldfusion ?
oops - I meant CFIF parameterexists(FORM.NAME_PREFIX) IS no or #trim(FORM.NAME_PREFIX)# is '' SCRIPT Language=JavaScript alert(Please Select a Prefix); history.back(); /SCRIPT CFABORT /CFIF I'm really sloppy this morning :-) JoAnn A. Schlosser Senior Consultant Association Management Software Grant Thornton LLP Washington, D. C. 703.837.4428 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 16, 2001 8:41 AM To: CF-Talk Subject: RE: Javascript Validation Coldfusion ? I tend to place the js in the action page, assuming the dropdown is in a form. This is what I use to force someone to select a value from a prefix field. CFIF parameterexists(FORM.NAME_PREFIX) IS no or #trim(FORM.PREFIX)# is '' SCRIPT Language=JavaScript alert(Please Select a Prefix); history.back(); /SCRIPT CFABORT JoAnn A. Schlosser Senior Consultant Association Management Software Grant Thornton LLP Washington, D. C. 703.837.4428 This e-mail is intended solely for the person or entity to which it is addressed and may contain confidential and/or privileged information. Any review, dissemination, copying, printing or other use of this e-mail by persons or entities other than the addressee is prohibited. If you have received this e-mail in error, please contact the sender immediately and delete the material from any computer. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Javascript Validation Coldfusion ?
Why would you put it in the action page. You are requiring an extra trip to the server if you do that. If you put your validation in the calling page and trigger it with the onclick event of the submit button you save that trip. - Original Message - From: [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, August 16, 2001 6:40 AM Subject: RE: Javascript Validation Coldfusion ? I tend to place the js in the action page, assuming the dropdown is in a form. This is what I use to force someone to select a value from a prefix field. CFIF parameterexists(FORM.NAME_PREFIX) IS no or #trim(FORM.PREFIX)# is '' SCRIPT Language=JavaScript alert(Please Select a Prefix); history.back(); /SCRIPT CFABORT JoAnn A. Schlosser Senior Consultant Association Management Software Grant Thornton LLP Washington, D. C. 703.837.4428 This e-mail is intended solely for the person or entity to which it is addressed and may contain confidential and/or privileged information. Any review, dissemination, copying, printing or other use of this e-mail by persons or entities other than the addressee is prohibited. If you have received this e-mail in error, please contact the sender immediately and delete the material from any computer. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Javascript Validation Coldfusion ?
Try the following for your two select fields: if(document.form.sel1.value == 1){ missinginfo += \n - Please select option for Sel1; } if(document.form.sel2.value == 1){ missinginfo += \n - Please select option for Sel2; } Be sure and set up both Selects as follows for this to work: select name=sel1 option value=1 SELECTEDChoose option for this select/option option value=2Option2 Sel 2/option /select select name=sel2 option value=1 SELECTEDChoose option for this select/option option value=2Option 2 Sel2/option /select I do not know what you are asking as far as your CFFILE question though. Larry Juncker Senior Cold Fusion Developer Heartland Communications Group, Inc. [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 16, 2001 2:34 AM To: CF-Talk Subject: Javascript Validation Coldfusion ? Hi How do you add validation to drop down form select boxes using Javascript. I have added validation (shown below in the js) for the two text input fields but need to build in validation for the two select boxes and also a CFFile field as these are required fields in the form, any ideas on how to integrate this into what I have below? SCRIPT LANGUAGE=JavaScript !-- Begin function checkFields() { missinginfo = ; if (document.form.filename.value == ) { missinginfo += \n - Title of the File Uploaded; } if (document.form.filesummary.value == ) { missinginfo += \n - Descriptive Summary of Uploaded File; } if (missinginfo != ) { missinginfo = ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Javascript Validation Coldfusion ?
You're right. Dummy me. I inherited a site that works like this and when I needed to validate another field, I just parked it with the others. Not the best answer. JoAnn A. Schlosser Senior Consultant Association Management Software Grant Thornton LLP Washington, D. C. 703.837.4428 -Original Message- From: Don Vawter [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 16, 2001 8:48 AM To: CF-Talk Subject: Re: Javascript Validation Coldfusion ? Why would you put it in the action page. You are requiring an extra trip to the server if you do that. If you put your validation in the calling page and trigger it with the onclick event of the submit button you save that trip. - Original Message - From: [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, August 16, 2001 6:40 AM Subject: RE: Javascript Validation Coldfusion ? I tend to place the js in the action page, assuming the dropdown is in a form. This is what I use to force someone to select a value from a prefix field. CFIF parameterexists(FORM.NAME_PREFIX) IS no or #trim(FORM.PREFIX)# is '' SCRIPT Language=JavaScript alert(Please Select a Prefix); history.back(); /SCRIPT CFABORT JoAnn A. Schlosser Senior Consultant Association Management Software Grant Thornton LLP Washington, D. C. 703.837.4428 This e-mail is intended solely for the person or entity to which it is addressed and may contain confidential and/or privileged information. Any review, dissemination, copying, printing or other use of this e-mail by persons or entities other than the addressee is prohibited. If you have received this e-mail in error, please contact the sender immediately and delete the material from any computer. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Javascript Validation Coldfusion ?
I do something similar, but run into problems with page caching. For instance, if an item was added to the database table the populates the drop-down, between the time you submitted, and hit the OK button to the alert box, the new item will not appear in the drop down. The only way around this that I can see is to force no caching of the form page. Unfortunately, enforcing no caching introduces some other little issues (Data Missing messages when hitting the back button). So, I think we will be moving to JS validation on the submitting page - which would resolve these issues. Hope this info helps someone. Shawn Grover -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 16, 2001 6:41 AM To: CF-Talk Subject: RE: Javascript Validation Coldfusion ? I tend to place the js in the action page, assuming the dropdown is in a form. This is what I use to force someone to select a value from a prefix field. CFIF parameterexists(FORM.NAME_PREFIX) IS no or #trim(FORM.PREFIX)# is '' SCRIPT Language=JavaScript alert(Please Select a Prefix); history.back(); /SCRIPT CFABORT JoAnn A. Schlosser Senior Consultant Association Management Software Grant Thornton LLP Washington, D. C. 703.837.4428 This e-mail is intended solely for the person or entity to which it is addressed and may contain confidential and/or privileged information. Any review, dissemination, copying, printing or other use of this e-mail by persons or entities other than the addressee is prohibited. If you have received this e-mail in error, please contact the sender immediately and delete the material from any computer. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Javascript Validation Coldfusion ?
hi, Just a improvement i suggest as this command works in netscape as well as in IE. if (document.form.select_fld_name[document.form.select_fld_name.options.selectedIndex].value == 0) The mentioned one if (document.form.fieldname[selectedIndex].value == ){ may not work in netscape. thanks regards Sanjeevi --- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. -- Phoenix Global Solutions (India) Pvt Ltd., www.pgsolutions.com - Steve Reich sr_lists@pagecTo: CF-Talk [EMAIL PROTECTED] oders.com cc: Subject: Re: Javascript Validation Coldfusion ? 08/16/01 05:52 PM Please respond to cf-talk First I recommend you send a blank email to [EMAIL PROTECTED] and join JS-Jive, the javascript list. You'll get lots of help with Javascript. But to answer your question, you need to access the selectedIndex property of a select box to validate it script function validateSelect(){ if (document.form.fieldname[selectedIndex].value == ){ alert(Please select an option in the select box.); return false; } } /script onsubmit=return validateSelect() This assumes that you have an option in the select box with an empty value... option value=(select option) HTH, Steve [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi How do you add validation to drop down form select boxes using Javascript. I have added validation (shown below in the js) for the two text input fields but need to build in validation for the two select boxes and also a CFFile field as these are required fields in the form, any ideas on how to integrate this into what I have below? SCRIPT LANGUAGE=JavaScript !-- Begin function checkFields() { missinginfo = ; if (document.form.filename.value == ) { missinginfo += \n - Title of the File Uploaded; } if (document.form.filesummary.value == ) { missinginfo += \n - Descriptive Summary of Uploaded File; } if (missinginfo != ) { missinginfo = ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists