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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:10:06+00:00 2026-06-09T01:10:06+00:00

In my trade order form, if the user selects order type = limit then

  • 0

In my trade order form, if the user selects order type = “limit” then a limit price must be specified. I am trying to enforce this rule using a funcCall, but it is not working. If limit order is selected and the limit price field is left blank, the validation engine validates the form successfully. Here’s my HTML:

<li>
    <label for=tradeForm_orderType>Order Type</label>
    <select id=tradeForm_orderType name=orderParams.type>
        <option value=Market>Market</option>
        <option value=Limit>Limit</option>
    </select>
</li>            

<li id=tradeForm_limitPriceItem>
    <label for=tradeForm_limitPrice>Limit Price</label>
    <input class="validate[funcCall[checkLimitOrder],custom[number]]"
        type=text name=orderParams.limitPrice.amount id=tradeForm_limitPrice>
</li>

And here’s my checkLimitOrder function:

function checkLimitOrder(field, rules, i, options) {
    if ($('#tradeForm_orderType').val() === 'Limit' && field.val().length === 0) {
        return 'Please enter a limit price';
    }
}

This almost works! checkLimitOrder is indeed called and it returns the error message. However on return, the jQuery validation engine ignores the error message based on the following logic (lines 582-583):

// If the rules required is not added, an empty field is not validated
if(!required && field.val() == "") options.isError = false;

Well, I can’t make the field required as it is only conditionally required. Is there any way I can work around this issue?

  • 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-09T01:10:07+00:00Added an answer on June 9, 2026 at 1:10 am

    Answering my own question.

    Turns out that the validation engine does not validate hidden fields (although this is not explicitly documented. So the solution was to hide limitPriceItem when the field was not required. Now I can put “validate[required,custom[number]]” on the limit price field and it validates only when the field is visible.

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

Sidebar

Related Questions

So I have this form <form> <div> <span class=form_t>I Want To Trade In <span
There are two strings. String str1=Order Number Order Time Trade Number; String str2=Order Tm;
I am trying to understand the trade offs/differences between these to ways of opening
I want to preface this by saying I believe the Right™ Way to handle
I'm using ASP.NET 3.5. I made a form that when the user clicks a
I'm trying to get a list of entities with their collection order by datetime,
I am trying to use examples that are fun/interesting to me in order to
I have a table 'TYPE' in this table i have 2 columns as 'SKEY'
SELECT Trade.TradeId, Trade.Type, Trade.Symbol, Trade.TradeDate, SUM(TradeLine.Notional) / 1000 AS Expr1 FROM Trade INNER JOIN
We have a form that allows a user to filter a list with by

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.