最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How do I use onblur to do multiple checks - Stack Overflow

programmeradmin1浏览0评论

I have 2 functions that do entirely different things but use 1 field input to check the validations.

How could I use onblur to check both functions at the same time from the field?

Range of sales in the neighborhood is 
$ <input tabindex="36" type="text" id="PS_FORM/MARKET_DATA/NeighborhoodSales1" name="PS_FORM/MARKET_DATA/NeighborhoodSales1" value="{{PS_FORM/MARKET_DATA/NeighborhoodSales1}}" />
to 
$ <input tabindex="37" type="text" id="PS_FORM/MARKET_DATA/NeighborhoodSales2" name="PS_FORM/MARKET_DATA/NeighborhoodSales2" value="{{PS_FORM/MARKET_DATA/NeighborhoodSales2}}" /> 
Total # of Properties <input tabindex="38" type="text" id="PS_FORM/MARKET_DATA/NeighborhoodSalesNum" name="PS_FORM/MARKET_DATA/NeighborhoodSalesNum" value="{{PS_FORM/MARKET_DATA/NeighborhoodSalesNum}}" onblur="fill_duplicate(this, document.getElementById('PS_FORM/MARKET_DATA/Number_Comps'))" />

I want to check with thsi function as well

function get_adjusted_value( sale_price, adjustment, adjusted_value, x) {  

Thanks in advance

I have 2 functions that do entirely different things but use 1 field input to check the validations.

How could I use onblur to check both functions at the same time from the field?

Range of sales in the neighborhood is 
$ <input tabindex="36" type="text" id="PS_FORM/MARKET_DATA/NeighborhoodSales1" name="PS_FORM/MARKET_DATA/NeighborhoodSales1" value="{{PS_FORM/MARKET_DATA/NeighborhoodSales1}}" />
to 
$ <input tabindex="37" type="text" id="PS_FORM/MARKET_DATA/NeighborhoodSales2" name="PS_FORM/MARKET_DATA/NeighborhoodSales2" value="{{PS_FORM/MARKET_DATA/NeighborhoodSales2}}" /> 
Total # of Properties <input tabindex="38" type="text" id="PS_FORM/MARKET_DATA/NeighborhoodSalesNum" name="PS_FORM/MARKET_DATA/NeighborhoodSalesNum" value="{{PS_FORM/MARKET_DATA/NeighborhoodSalesNum}}" onblur="fill_duplicate(this, document.getElementById('PS_FORM/MARKET_DATA/Number_Comps'))" />

I want to check with thsi function as well

function get_adjusted_value( sale_price, adjustment, adjusted_value, x) {  

Thanks in advance

Share Improve this question edited Jan 17, 2012 at 16:47 Abbas 6,8744 gold badges37 silver badges49 bronze badges asked Jan 17, 2012 at 16:42 DarenDaren 611 gold badge3 silver badges9 bronze badges 2
  • Please include your current code and the actual generated HTML so we can see how it needs to work. – jfriend00 Commented Jan 17, 2012 at 17:05
  • right now the first line of code works perfectly--I want to add the function that is below it to the line of code above. As you can see there is already an onblur that is validating to fill a duplicate field. my new function will get a price from a vendor and if it doesnt match a range it will change the range to the new value. – Daren Commented Jan 17, 2012 at 17:19
Add a ment  | 

1 Answer 1

Reset to default 3

Define a function that calls both:

function MyValidation(){
    ValidateFunc1();
    ValidateFunc2();
}

And then attach that to the onblur:

<input onblur="MyValidation();" />

Or through late binding:

document.getElementById("MycontrolId").onblur = MyValidation;
发布评论

评论列表(0)

  1. 暂无评论