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

  • SEARCH
  • Home
  • 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 9173029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:29:37+00:00 2026-06-17T16:29:37+00:00

Got a jsfiddle here where I am trying to sort out a confirmation which

  • 0

Got a jsfiddle here where I am trying to sort out a confirmation which should appear after a submit to make sure if user wants to submit:

http://jsfiddle.net/baxGm/1/

Problem is that confirmation is not appearing, does anyone know why this is?

HTML:

<form id='choiceForm' action='assessment.php' method='post'>
    <p><strong>Chosen Assessment:</strong></p>
    <table>
    <tr>
        <th></th>
        <td><input type='hidden' id='currentId' name='Idcurrent' readonly='readonly' value='' /></td>
    </tr>
    <tr>
        <th>Assessment:</th>
        <td><input type='text' id='currentAssessment' name='Assessmentcurrent' readonly='readonly' value='' /></td>
    </tr>
    <tr>
        <th>Date:</th>
        <td><input type='text' id='currentDate' name='Datecurrent' readonly='readonly' value='' /></td>
    </tr>
    <tr>
        <th>Start Time:</th>
        <td><input type='text' id='currentTime' name='Timecurrent' readonly='readonly' value=''/></td>
    </tr>
    </table>
    <p id='submitchoicebtn'>
        <input id='choiceSubmit' type='submit' value='Choose Assessment' name='choiceSubmit' onClick='myClickHandler(); return false;'/>
    </p>
    <div id='currentAlert'></div>
</form>

Jquery:

function choicevalidation() {
    var isDataValid = true;
    var currentAssesO = document.getElementById("currentAssessment");
    var currentAssesMsgO = document.getElementById("currentAlert");

    currentAssesMsgO.innerHTML = "";

    if (currentAssesO.value == "") {
        $('#targetdiv').hide();
        currentAssesMsgO.innerHTML = "Please Select an Assessment to edit from the Assessment Drop Down Menu";
        isDataValid = false; 
    } else {
        currentAssesMsgO.innerHTML = "";
    }
    return isDataValid;
}

function showConfirm() {
    var examInput = document.getElementById('curentAssessment').value;
    var dateInput = document.getElementById('currentDate').value;
    var timeInput = document.getElementById('currentTime').value;

    return confirm("Are you sure you want to take the following Assessment:" + "\n" + "Exam: " + examInput +  "\n" + "Date: " + dateInput + "\n" + "Time: " + timeInput);
}  

function myClickHandler() {
    if (choicevalidation()) {
        showConfirm();
    }
}

UPDATE:

        <body>

    <script type="text/javascript">


        $('#sessionsDrop').change( function(){

            $('#targetdiv').hide();

            if( $(this).val() !== '' ){
                var text = $(this).find('option:selected').text();
                var split = text.split(' - ');
                $('#currentId').val($(this).find('option:selected').val());
                $('#currentAssessment').val( split[0] );     
                $('#currentDate').val( split[1] );     
                $('#currentTime').val( split[2] );     
            }
            else{
                $('#currentAssessment,#currentDate,#currentTime,#currentId').val('');           
            }
        });

        $('#assessmentForm').delegate('change','select',(function(warnings)
{
    return function()
    {
        warnings.html('');
    };
}($('#warnings'))));



function validation(e) {

                var isDataValid = true;

                var moduleTextO = document.getElementById("modulesDrop");

                var errModuleMsgO = document.getElementById("moduleAlert");

         if (moduleTextO.value == ""){
          $('#targetdiv').hide();
          $('#assessmentForm').hide();
          $('#choiceForm').hide();
          $('#submitchoicebtn').hide();
          errModuleMsgO.innerHTML = "Please Select a Module";
          isDataValid = false;    
        }else{
                errModuleMsgO.innerHTML = ""; 
            }

                if (isDataValid === false)
    {
        if (e.preventDefault)
        {
            e.preventDefault();
            e.stopPropagation();//VERY important
        }
        e.returnValue = false;
        e.cancelBubble = true;
    }

            return isDataValid;

            }

       function choicevalidation() {

                var isDataValid = true;

                var currentAssesO = document.getElementById("currentAssessment");

                var currentAssesMsgO = document.getElementById("currentAlert");

          currentAssesMsgO.innerHTML = "";


      if (currentAssesO.value == ""){
          $('#targetdiv').hide();
          currentAssesMsgO.innerHTML = "Please Select an Assessment to edit from the Assessment Drop Down Menu";
          isDataValid = false; 
        }else{
            currentAssesMsgO.innerHTML = "";
        }
            return isDataValid;


        }


        function showConfirm(){

              var examInput = $('#currentAssessment').val();
            var dateInput = $('#currentDate').val();
            var timeInput = $('#currentTime').val();

            return confirm("Are you sure you want to take the following Assessment:" + "\n" + "Exam: " + examInput +  "\n" + "Date: " + dateInput + "\n" + "Time: " + timeInput)          
} 


$('#choiceSubmit').click(function(e){myClickHandler(e)});

function myClickHandler(e){
    e.preventDefault(); 
     if(choicevalidation()){ 
                if(showConfirm())
                   $('#choiceForm').submit();
     } 
}

    </script>   

   Logged In: <b>Mayur Patel</b> | <a href='./studentlogout.php'>Logout</a>     
        <div class="topcorner"><a id="studentmenulink" href="studentmenu.php">Back to Menu</a></div>

        <noscript style='color: red'><img src="Images/warning-2.fw.png" alt="Javascript Warning" id="warningImage" name="warningSymbol"/> In order to use this application without any problems, you must have javascript enabled</noscript>


        <div id="js">


<h1>TAKE AN ASSESSMENT</h1>   

<form action="/u0867587/Mobile_app/assessmentchoice.php" method="post" onsubmit="return validation(event);">
<table>
<tr>
<th>Module: <select name="modules" id="modulesDrop">
<option value="">Please Select</option>
<option value="CHI2513_Systems Strategy_1">CHI2513 - Systems Strategy</option>
<option value="CHT2220_Interactive Systems_4">CHT2220 - Interactive Systems</option>
</select></th>
</tr>
</table>
<p><input id="moduleSubmit" type="submit" value="Submit Module" name="moduleSubmit" /></p>
<div id="moduleAlert"></div>
<div id="targetdiv"></div>
</form>

<div id='lt-container'>
<form action='/u0867587/Mobile_app/assessmentchoice.php' method='post' id='assessmentForm'>
<p id='warnings'></p>
<p><strong>Selected Module:</strong> CHI2513 - Systems Strategy <input type='hidden' value='1'></p>
<p><strong>Assessments:</strong> <select name="session" id="sessionsDrop">
<option value="">Please Select</option>
<option value='28'>LDREW - 09-01-2013 - 09:00</option>
<option value='29'>BQNYF - 10-01-2013 - 10:00</option>
<option value='22'>WDFRK - 17-01-2013 - 09:00</option>
<option value='26'>POKUB1 - 25-01-2013 - 15:00</option>
</select> </p>   
</form>
</div>
<div id='rt-container'>
<form id='choiceForm' action='assessment.php' method='post'>

    <p><strong>Chosen Assessment:</strong></p>
    <table>
    <tr>
    <th></th>
    <td><input type='hidden' id='currentId' name='Idcurrent' readonly='readonly' value='' /> </td>
    </tr>
    <tr>
    <th>Assessment:</th>
    <td><input type='text' id='currentAssessment' name='Assessmentcurrent' readonly='readonly' value='' /> </td>
    </tr>
    <tr>
    <th>Date:</th>
    <td><input type='text' id='currentDate' name='Datecurrent' readonly='readonly' value='' /> </td>
    </tr>
    <tr>
    <th>Start Time:</th>
    <td><input type='text' id='currentTime' name='Timecurrent' readonly='readonly' value=''/> </td>
    </tr>
    </table>
    <p id='submitchoicebtn'>
    <input id='choiceSubmit' type='submit' value='Choose Assessment' name='choiceSubmit'/>    
    </p>
    <div id='currentAlert'></div>
    </form>

    </div>

</div>

<script type="text/javascript">
document.getElementById('js').style.display = 'block';
</script>

    </body>
  • 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-17T16:29:38+00:00Added an answer on June 17, 2026 at 4:29 pm

    myClickHandler() is not a global function it is in context of jquery onload function, so you get “myClickHandler is not defined” error.

    Use regular jquery event binding instead of inline onclick and function

    $("#choiceSubmit").click(function(){
      if(choicevalidation()){ 
        showConfirm(); 
      } 
      return false;
    });
    

    http://jsfiddle.net/baxGm/3/

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

Sidebar

Related Questions

I'm trying to make two elements exchange their z-index value. Here's what I've got
I've got a problem which you can look at here http://jsfiddle.net/dng2P/4/ If you click
Got stuck here: http://jsfiddle.net/UFkg8/ Right now the animation is top-down. What do I need
All, I've got the following JS Fiddle: http://jsfiddle.net/HHtBX/11/ I'm trying to basically close all
I've got a tiny issue that I am trying to work out. I've put
Got a really tricky problem that I've been trying to figure out for a
I got a CSS question related to this fiddle: http://jsfiddle.net/r584e/ Here the relevant screenshot
Not sure what I'm missing here... I think i've got all the right pieces
I'm trying to make a calendar, and I've got it mostly working except I
This is what I got: http://jsfiddle.net/hashie5/vk6rZ/ (don't mind the layout) The first table is

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.