Solved

trying to make Jconfirm on Jquery work on my form but something is wrong.

Posted on 2011-03-07
7
946 Views
Last Modified: 2013-11-19
jconfirm works, but now sure how to pass my form element to my coldfusion function. when i submit my form, it should look for form element 'deny' and process.

but right now it cannot find my form element. i am new to jquery and not sure what is wrong on the srript.

please help


<script>
        function doShow(type){               
             if(type=="deny"){                                                           
               jConfirm('Are you sure to deny this request?', 'Confirmation Box', function(r) {
               
                if(r){     
                detail_form.deny = "deny";                         
                  $("#detail_form").submit();                                 
                  return true;                  
                }
                else
                  return false;
              }); 
            }                                
        }
</script>

<form id="detail_form" class="myform" format="html" action="components/admin.cfc?method=fProcessReq&num=#url.num#" method="post">

<input type="button" value="Deny" onClick="doShow('deny');" name="deny" id="deny">

</form>


Here is my sample component>>>>

<cffunction name="fProcessReq" access="remote" returntype="void" description="Approve functions for each request ID">
		<cfif IsDefined("url.num")>
			<cfdump var="#form#">
<cfif IsDefined("form.deny")>
                    <p>hi !!!!!!!!!!!</p>
                    <cfabort>
</cfif>

</cfif>

</cffunction>

Open in new window

0
Comment
Question by:khan02
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
7 Comments
 

Author Comment

by:khan02
ID: 35062390
when i click on 'Deny' Button, it submits the form and calls my coldfusion function, BUT within the Function Form.deny is not recognize.  I know that i am missing sumthing but not sure exactly what.

I have tried using type='submit' instead of type='button' as following>>
<input name="deny" type="submit" value="Deny" onClick="doShow('deny');return false;"> (doesn't work)

<input name="deny" type="submit" value="Deny" onClick="doShow('deny');">(doing that form gets submitted without clicking 'ok' or cancel )

Any idea how to modify that.

many thanks in advance.
0
 
LVL 11

Expert Comment

by:mvan01
ID: 35072480
khan02,

There's an error (unbalanced braces) in your doShow function.  If I'm not mistaken, this:
                                 
                  return true;                  
                }
                else
                  return false;

should be:                                

                  return true;                  
                } else {
                  return false;

Maybe this impacts your issue.

mvan
0
 

Author Comment

by:khan02
ID: 35074841
ok, i fixed the unlabalce braces, but still i can't pass the name of button to my coldfusion function to process some query based on button name. Thats the main question.

how can i do that? my function gets called but within my function i have a condition such as <cfif IsDefined("form.deny")>

.....then process some data

</cfif>

my function gets invoked but cant find "form.deny" (which is a type button)
0
 
LVL 42

Accepted Solution

by:
David S. earned 500 total points
ID: 35119634
You should use the form's onsubmit event instead of the button's onclick event. (And you should use a submit-type button.)
0
 

Author Closing Comment

by:khan02
ID: 35931894
thats not what i was looking for , but i can give u partial credit
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question