|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
Have you ever tried to explain server-side validation to a client...DONT they are morons...
After explaining that one page must go to another "action page" im still being asked to make a one page form without a submit button that knows if a person on a drop down menu chose student or teacher...this causes another part of the form to appear depending on what they chose. I attempted making the page submit to itself making it appear as the same page only checking CFIF's to add new parts, but one still needs to click on a submit button everytime. Is there anyway to do this without a submit button? Ive seen some dropdown menus on sites that act as a submit...anyway to do that in coldfusion? |
|
#2
|
|||
|
|||
|
Hi,
I hate this too. I know it can be done in Java script, and there may be something there in the forums, I am not too familiar with Java. You may also be able to do this using the on blur attribute on form items, again I have never done this myself. I think the best bet is to use Java as CF is very Java compatible. Sorry I ain't much help! I will keep an eye out as I would like to know this trick myself. |
|
#3
|
|||
|
|||
|
You can add an onChange() event handler to the form element that submits the form. But you're still submitting the form, all you've done is stop them from having to press the submit button. The page still has to reload. And, if the user has Javascript turned off the whole form will break. Finally, anyone using a screen reader (a blind person for example) will be unable to use the app becuase every time they try to scroll through a list in a select box for example, the page will reload.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#4
|
|||
|
|||
|
perhaps this might work.
you have a select let's say selectRole, <select name="selRole"> <option value="0">Select a role</option> <option value="1">Student</option> <option value="2">Teacher</option> </select> then you can put all your cf code in a <cfif> something like <cfif IsDefined('FORM.selRole') AND #FORM.selRole# NEQ 0> take some action <cfelse> display the form </cfif> i did use this logic couple times to have one page instead of one that takes the user input and another one that process that input. hope it helps.. |
|
#5
|
||||
|
||||
|
Here's an example of the JS solution mentioned above (sanitized a bit for public consumption):
Code:
<script language="JavaScript"><!--
function goto_URL(object) {
window.location.href = object.options[object.selectedIndex].value;
}
//--></script>
<form method=post action="director.cfm" name="myForm">
<select name="location" onChange="goto_URL(this.form.location)">
<option value="reports_menu.cfm">Select a report</option>
<option value="report_1.cfm">Report 1</option>
<option value="report_2.cfm">Report 2</option>
<option value="report_3.cfm">Report 3</option>
</select>
<input type="submit" value="Go">
</form>
The director.cfm script handles the redirect if the user doesn't have JS, or somehow manages to click the submit button before the JS can do it's magic. And it looks like this: Code:
<cfif #Parameterexists(FORM.location)# IS "YES"> <cflocation url="#FORM.location#"> <cfelse> <cflocation url="index.cfm"> </cfif> I never use JS without having a backup for users that don't have it. If you don't want to have a button just leave it out and it should work just fine for users with JS. |
|
#6
|
||||
|
||||
|
Thanks for the help, but i found the dropdown that automatically submits in some software called D2 tools for ms frontpage. Its a trial, but u can buy it or work fast, whichever...anyway here it is.
http://www.download.com/3302-2048_4-10255139.html |
|
#7
|
|||
|
|||
|
the ONACTION, ONCLICK, ONMOUSEOVER anything like that should work in FORM but nope (HTML need UPDATE standard). I had to add java script, however it's not really a cold fusion issue it's legacy of HTML never adding new sub catagories to it ... in past CGI scripts had to be used for forms, so at least programmers got submit option nowdays that you don't have to manipulate in CGI for a simple FORM....
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > My client is a Moron |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|