Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7791095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:46:54+00:00 2026-06-01T21:46:54+00:00

I’ve got a multi-file jquery phonegap app. I’m using phonegap 1.4.1, jQuery 1.7.1 and

  • 0

I’ve got a multi-file jquery phonegap app. I’m using phonegap 1.4.1, jQuery 1.7.1 and jQuery Mobile 1.1.0 RC1

In the head of the index file I’ve got a script block that fires on pageinit of a page called “kkpage”.
The block controls the submission of a form, as well as dynamic hiding/showing of elements on “kkpage”.

If submission is successful it transfers you to another page giving you the option to fill out the form again.

When going back to “kkpage” the script-block for the page seems to have fired twice: when pressing the submit button (“#kkopendialog”) the confirmation dialog opens twice allowing the user to press yes, thus submitting, twice

How can I get the code to run only once or remove/stop the code once the user submits the form?

I’m using changepage to navigate the app and I’m preloading pages using mobile.loadPage

The delegate code:

$( document ).delegate("#kkpage", "pageinit", function() {
...
});

I’ve been looking around here, googling and checking the jQM forums but none of the solutions have worked for me.
I’ve tried using jquery’s .one, .die and, .unbind as well as if conditions but to no avail.

Any and all help is deeply appreciated!

UPDATE: MORE CODE BELOW

Index:

$( document ).delegate("#kkpage", "pageinit", function(event) {
$("#klinikkurt #KKopendialog").click(BlurIt2);                        
function BlurIt2() {
$("#klinikkurt #q15").blur();
$("#klinikkurt #q16").blur();
}   
function SubKK(button) {
if (button == 1){
$("#klinikkurt").submit();
}
else if (button == 2){
}
}
function showConfirmKK(cdata) {
navigator.notification.confirm(
'\304r du s\344ker p\345 att du vill skicka in din Kurtning?',  // message
SubKK,              // callback to invoke with index of button pressed
'Skicka in?',            // title
'Ja,Nej'          // buttonLabels
);
}
$('#KKopendialog').addClass('ui-disabled');
$("#KKopendialog").live('tap', function(event) {
showConfirmKK();
return false;
});
$("#klinikkurt").submit(function(e) {
$.mobile.showPageLoadingMsg();
var dataString = $("#klinikkurt").serialize();
$.ajax({
type: "POST",
url: "http://DOMAIN.se/script/kurt2/receive.php",
data: dataString,
datatype: "html",
success: function() {
$.mobile.changePage( "tackkk.html", { transition: "turn"} );
window.plugins.googleAnalyticsPlugin.trackPageview("KKifyllt");
}});
e.preventDefault();
});
});

“kkpage” contains a form as well as a submit button:

    <a href="#" id="KKopendialog" data-role="button">Skicka in</a>

Since it’s on multiple pages I didn’t know how to jsfiddle it

UPDATE 2: Form html as requested:

    <form id="klinikkurt" method="POST" target="result" ><input type="hidden" name="id" value="XXXX" /><input type="hidden" name="noframe" value="" />
                <h2>Placering / ort</h2>

                <div class="questioncontainer">
                    1.&#9;Placering<br />
                    <select name="q1" id="q1" data-theme="d">
                        <option value="null"> -- Välj alternativ -- </option>
                        <option id="24" value="24" >T9 Psykiatri</option>
                        <option id="25" value="25" >T9 Ögon</option>
                        <option id="26" value="26" >T9 Öron-näsa-hals</option>
                        <option id="27" value="27" >T10 Gynekologi</option>
                        <option id="28" value="28" >T10 Obstetrik</option>
                        <option id="29" value="29" >T10 Pediatrik</option>
                    </select><br /></div>

                <div class="questioncontainer">
                    2.&#9;Ort
                    <select name="q2" id="q2" data-theme="d">
                        <option value="null"> -- Välj alternativ -- </option>
                        <option id="1" value="1" >Arvika</option>
                        <option id="2" value="2" >Avesta</option>
                        <option id="3" value="3" >Bollnäs</option>
                        <option id="4" value="4" >Enköping</option>
                        <option id="5" value="5" >Eskilstuna</option>
                        <option id="23" value="23" >Tierp</option>
                        <option id="24" value="24" >Uppsala</option>
                        <option id="25" value="25" >Visby</option>
                        <option id="26" value="26" >Västerås</option>
                        <option id="27" value="27" >Örebro</option>
                        <option id="28" value="28" >Östhammar</option>
                    </select><br /></div>

                <div class="questioncontainer">
                    <div class="fewq">9.</div><div class="moreq">10.</div>&#9;I vilken grad fick du själv aktivt handlägga patienter (t.ex. leda rond, resonera/diskutera/föreslå diagnoser/utredningar/behandlingar)?
                    <div class="popupright">I allra högsta grad</div>
                    <div class="popupleft" style="position:relative;bottom:-30px">Inte alls</div>
                    <div style="position:relative;top:-25px;;">
                        <div data-role="fieldcontain">
                            <fieldset data-role="controlgroup" data-type="horizontal">
                                <legend>&nbsp;</legend>
                                <input type="radio" name="q11" id="1" value="1"/>
                                <label for="1"> &nbsp;</label>

                                <input type="radio" name="q11" id="2" value="2"/>
                                <label for="2">&nbsp;</label>

                                <input type="radio" name="q11" id="3" value="3"  />
                                <label for="3">&nbsp;</label>

                                <input type="radio" name="q11" id="4" value="4"  />
                                <label for="4">&nbsp;</label>

                                <input type="radio" name="q11" id="5" value="5"  />
                                <label for="5">&nbsp;</label>

                                <input type="radio" name="q11" id="6" value="6"  />
                                <label for="6">&nbsp;</label>
                            </fieldset>
                        </div>
                    </div>
                </div>

                <div id="kkreqmsg"><br><br>Oj då! Du kan tyvärr inte skicka in en kurtning utan att ange termin och placering!</div>


                <a href="#" id="KKopendialog" data-role="button">Skicka in</a>
            </form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T21:46:56+00:00Added an answer on June 1, 2026 at 9:46 pm

    The solution I came up with for the site I’m working on was delegating the click events as well as the pageint event:

    $('body').delegate('#page', 'pageinit' ,function(){
        $('#page').delegate(selector, 'click', function(e){...});
    });
    

    Hope this works for you too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am using Paperclip to handle profile photo uploads in my app. They upload
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.