![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 33 Pomógł: 0 Dołączył: 9.06.2009 Ostrzeżenie: (0%) ![]() ![]() |
Witam.
W JS jestem zielony jak szczypior na wiosnę i potrzebuję pomocy. Mam dwa inputy określające szerokość i wysokość pola. Warunkiem jest , że jeden z wymiarów nie może przekroczyć 150 cm Wymyśliłem taki kod
Ale pętla nie bardzo działa. Działa walidacja, pilnuje czy wartości nie są za małe i czy sa liczbami ale to wszystko. Proszę uprzejmie o pomoc zielonemu. Pozdrawiam ermar |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 33 Pomógł: 0 Dołączył: 9.06.2009 Ostrzeżenie: (0%) ![]() ![]() |
Tak - jest.
Odnosi się jednak do standardowej walidacji pól. Z tym nie mam problemu. To opis " Numericality (static function) Top Validates that the value is numeric and: is an integer, is a specific number, is more than a minimum number, less than a maximum number, is within a range of numbers, or a combination of these NB - numbers expressed in scientific form (ie 2e3, being 2000) are handled correctly, as are negative numbers, and floats. Arguments: value - {mixed} - value to be checked paramsObj (optional) - {Object} - object containing parameters to be used for the validation Parameters for paramsObj: notANumberMessage (optional) - {String} - message to be used when validation fails because value is not a number (DEFAULT: “Must be a number!”) notAnIntegerMessage (optional) - {String} - message to be used when validation fails because value is not an integer (DEFAULT: “Must be an integer!”) wrongNumberMessage (optional) - {String} - message to be used when validation fails when ‘is’ param is used (DEFAULT: “Must be {is}!”) tooLowMessage (optional) - {String} - message to be used when validation fails when ‘minimum’} param is used (DEFAULT: “Must not be less than {minimum}!”) tooHighMessage (optional) - {String} - message to be used when validation fails when ‘maximum’} param is used (DEFAULT: “Must not be more than {maximum}!”) is (optional) - {mixed} - the value must be equal to this numeric value minimum (optional) - {mixed} - the minimum numeric allowed maximum (optional) - {mixed} - the maximum numeric allowed onlyInteger (optional) - {Boolean} - if true will only allow integers to be valid (DEFAULT: false) Returns: true if valid or throws a Validate.Error object containing the failure message Example: // check that value is an integer between -5 and 2000 exists in the string, case insensitive... Validate.Numericality( 2e3, { minimum: -5, maximum: 2000 } ); " Podziwiam, że warto się tak dowartościowywać kosztem niewiedzy innej osoby. Ten post edytował ermar 5.11.2011, 13:54:12 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 15.10.2025 - 19:14 |