[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

Forms without push buttons?

Is it possible to have a form in ColdFusion which performs the form action when an value from the list box is selected rather than clicking on a Push button or does this have to be done with Javascript? Note I will only have one list box in the form and no other objects.
0
cb1
Asked:
cb1
  • 4
  • 4
  • 2
  • +4
1 Solution
 
selmerCommented:
I don't think it can be done with straight ColdFusion... i myself spent quite some time trying to do it that way, so i'm pretty sure it has to be javascript, unfortunately i can't really help you with the actual code, sorry

-josh

0
 
deepchandaCommented:
This can be easily done in javascript, here it goes ...


<script>
function submitform() {
     document.formname.submit();
     return true;
   }
</script>

<form name="form1" action="abc.htm">
<SELECT
  NAME="selectName"
  ONCHANGE="return submitform()"
>
..

</form>
0
 
nathansCommented:
It can only be done with JavaScript or Java and I would recommend JavaScript.

0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
FRehmanCommented:
<HTML>
<HEAD>

<BR>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function select1_onchange() {

            document.form1.action="page2.asp"
            document.form1.submit();

}

//-->
</SCRIPT>
</HEAD>
<BODY>
<form name=form1 method=post action="">


<P><SELECT id=select1 name=select1 style="HEIGHT: 22px; WIDTH: 151px" LANGUAGE=javascript onchange="return select1_onchange()">
        <OPTION selected value=asd>sadsa
        <OPTION value=sdf>sr342</SELECT>
</P>
        
</form>
</BODY>
</HTML>
0
 
cb1Author Commented:
Thanks for the code, can you tell me what browser version this is compatible with?
0
 
cb1Author Commented:
Thanks for the code, can you tell me what browser version this is compatible with?
0
 
FRehmanCommented:
it work with both browser ie and netscape i check it personally
0
 
cb1Author Commented:
version 3 and above?
0
 
FRehmanCommented:
I check it in ie4 and netscape 4.6 and 4.7
0
 
deepchandaCommented:
FRehman

I think you have repeated my suggestion as an answer. The only thing different I found was that in your code the form action can be assigned at run-time, but that was not mentioned anywhere in  the original question.

DC
0
 
bigbadbCommented:
it is too bad that people like FRehman steal answers from others then post it as an answer!!!!  Shame on you FRehman at least post as a comment :(
0
 
FRehmanCommented:
dear bigbadb
         when some one ask any question please describe it briefly not write short .when I answer any body I try to describe it briefly and user can easlyt understand it you i think cb1 has common scense if he think that I was wrong then he regect my answer
0
 
cb1Author Commented:
Just to point out 'he' is a 'she'! Thanks to you all for your help. Sorry FRehman but I feel I should accept DeepChanda's answer as they are both similar and DeepChanda's was first.
0
 
jacqueschoquetteCommented:
Actualy if you read the question again it should have been  nathans  who got the credit he was the first to answer the question correctly!
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

  • 4
  • 4
  • 2
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now