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 7196197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:43:55+00:00 2026-05-28T20:43:55+00:00

Below is code for a dojo Dialog that will pop up to enable the

  • 0

Below is code for a dojo Dialog that will pop up to enable the user to select beginning and ending dates for a query that will be submitted to a database. What I want to do is ensure that the user has selected both dates before they are able click the submit button. I thought that setting the ‘required: true’ attribute on the dateTextBoxes would have solved the problem. However, that attribute only fires if the user clicks on the dateTextBox, and then clicks on something else without actually selecting a date. If I never click on the dateTextBoxes at all, I can still click the submit button and generate a query with beginning and end dates as ‘null’. So, I’ve considered setting the submit button to ‘disabled’, but what’s the best way to check that the dateTextBoxes have values before enabling the button?

dojo.require("dojo.parser");            
dojo.require("dijit.Dialog");                         
dojo.require("dijit.form.Button");             
dojo.require("dijit.form.DateTextBox");                 
dojo.require("dijit.form.Form");

var historyDialog, historyForm, hdDateTextBox1, hdDateTextBox2;

dojo.ready(function(){createHistoryDialog(); buildHistoryForm();});  

function createHistoryDialog(){                  
    historyDialog = new dijit.Dialog({                     
    title: "Query Task History",                        
    style: "width:300px; height:350px; text-align: center; font-size: 16px;",                
    id: "historyDialogBox"
    });             
}                                                         

function buildHistoryForm(){        

    historyForm = new dijit.form.Form({                     
        encType: 'multipart/form-data'
        },dojo.doc.createElement('div'));    

    hdDateTextBox1 = new dijit.form.DateTextBox({                     
        id: "beginningQueryDate",                      
        onChange: function(date){dijit.byId('endingQueryDate').constraints.min = date;},          
        required: true,      //this doesn't seem to be working               
        constraints: {datePattern: 'yyyyMMdd'}                                    
    });                                  

    hdDateTextBox2 = new dijit.form.DateTextBox({                     
        id: "endingQueryDate",                      
        onChange: function(date){dijit.byId('beginningQueryDate').constraints.max = date;},                    
        required: true,        //this doesn't seem to be working             
        constraints: {datePattern: 'yyyyMMdd'}                                     
    });                                  

    var historySubmitButton = new dijit.form.Button({                     
        id: 'historySubmitButton',               
        onClick: submitHistoryQuery,   
        type: 'submit',       
        label: "Show History"                 
    });    

    historyForm.domNode.appendChild(dojo.create("label", {innerHTML: "myTask", style: "font-size: 20px;"}));      
    historyForm.domNode.appendChild(dojo.create("br"));                   
    historyForm.domNode.appendChild(dojo.create("br"));                  
    historyForm.domNode.appendChild(dojo.create("label", {innerHTML: "Beginning Date:"}));
    historyForm.domNode.appendChild(dojo.create("br"));                 
    historyForm.domNode.appendChild(hdDateTextBox1.domNode);                 
    historyForm.domNode.appendChild(dojo.create("br"));                 
    historyForm.domNode.appendChild(dojo.create("br"));                 
    historyForm.domNode.appendChild(dojo.create("label", {innerHTML: "EndingDate:"}));
    historyForm.domNode.appendChild(dojo.create("br"));
    historyForm.domNode.appendChild(hdDateTextBox2.domNode);                 
    historyForm.domNode.appendChild(dojo.create("br"));                 
    historyForm.domNode.appendChild(dojo.create("br"));                 
    historyForm.domNode.appendChild(historySubmitButton.domNode);                 
    historyForm.domNode.appendChild(dojo.create("br"));                 
    historyForm.domNode.appendChild(dojo.create("br"));                              
}

showHistoryDialog = function(){     
    historyForm.reset();
    dojo.byId("historyDialogBox").appendChild(historyForm.domNode);
    historyDialog.show();                
};
  • 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-05-28T20:43:57+00:00Added an answer on May 28, 2026 at 8:43 pm

    One quick and easy way to do it, is simply to use the form’s onSubmit event, and check if the form is valid (this doesn’t happen automatically, as you have noticed 🙂 ).

    historyForm = new dijit.form.Form({                     
        encType: 'multipart/form-data',
        onSubmit: function(e) { if(!historyForm.validate()) dojo.stopEvent(e); }
    },dojo.doc.createElement('div'));    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below code is written to call parameterized select query in asp.net public bool checkConflictTime()
this is the weirdest thing. My code is below: function menuSwipe(init){ dojo.query('div.fill div.container div.menu
My below code works fine and is used to populate a <select> item with
The below code will not join, when debugged the command does not store the
I am populating a Dojo Combobox dropdown with values from JSON. The code below
Below code gives Too much recursion error in Jquery ui dialog $( #dialog-confirm ).dialog({
In the demo codes of dojo 1.6, I found some code like the below:
While executing this below Dojo code the call back mehod is calling the onFailure.
Below code returns ? rather than a random character. Any ideas? Please note that
Below code saying error incorreect syntax near Main INSERT INTO tbl ( 'Week', Main,

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.