trying to make Jconfirm on Jquery work on my form but something is wrong.
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>
Web DevelopmentjQueryJavaScriptScripting Languages
Last Comment
khan02
8/22/2022 - Mon
khan02
ASKER
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.
mvan01
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
khan02
ASKER
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)
I have tried using type='submit' instead of type='button' as following>>
<input name="deny" type="submit" value="Deny" onClick="doShow('deny');re
<input name="deny" type="submit" value="Deny" onClick="doShow('deny');">
Any idea how to modify that.
many thanks in advance.