So this an example. I'm not 100% sure it is the BEST example. I listen
for the pagecreate event, then bind to my form's submit. Running
return false prevented JQM from doing it's crap.

<!DOCTYPE html>
<html>

<head>
<title>Form - Example One</title>
<link rel="stylesheet"
href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css";
/>
<script src="http://code.jquery.com/jquery-1.6.1.min.js";></script>
<script 
src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js";></script>
<script>

$('#intro').live('pagecreate',function(event){
        console.log('pagecreate');
        $("#myForm").submit(function(e) {
                console.log('submit');
                console.log('custom stuff here');
                return false;
        });
});

</script>
</head>

<body>

<div data-role="page" id="intro">

        <div data-role="header">
        <h1>Feedback Form</h1>
        </div>

        <div data-role="content">
        
                <form action="echo.cfm" method="post" id="myForm">
                        <div data-role="fieldcontain">
                                <label for="name">Your Name:</label>
                                <input type="text" name="name" id="name" />
                        </div>

                        <div data-role="fieldcontain">
                                <label for="email">Your Email:</label>
                                <input type="email" name="email" id="email" />
                        </div>

                        <div data-role="fieldcontain">
                                <label for="comments">Your Comments:</label>
                                <textarea name="comments" 
id="comments"></textarea>
                        </div>

                        <p>
                                <input type="submit" value="Send Comments">
                        </p>
                        
                </form>
        </div>

        <div data-role="footer">
        Copyright 2011.
        </div>

</div>



</body>
</html>



On Thu, Jun 30, 2011 at 10:39 AM, Raymond Camden
<[email protected]> wrote:
> On Thu, Jun 30, 2011 at 10:29 AM, Rick Faircloth
> <[email protected]> wrote:
>>
>> Hi, Ray... I appreciate the work you did in putting together
>> the jQuery Mobile Quick Start Guide, but it's really just a
>> more limited version of the Intro to jQuery Mobile found here:
>>
>> http://www.ibm.com/developerworks/web/library/wa-jqmobile/
>
> Well, respectfully, I disagree. I wanted an approach that was simpler.
> For example, the IBM one takes a while to get to the actual HTML for
> creating a page. There's going to be many guides out there and
> different approaches of course.
>
>
>> In index.cfm: (with non-essential code stripped out)
>>
>
> Yowza. That's a lot. :)  I'd begin first by simpy ensuring that my
> form click handler is operating correctly. JQM wants to take over
> forms by default. You can bypass this a few ways - here is one:
>
> http://forum.jquery.com/topic/disable-ajax-on-forms
>
> But basically- your first step is to ensure that JQM is NOT handling
> the form submission for you. You want to ensure your code is. Make
> your handler just console.log something and forget about calling any
> CFC now.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345963
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to