Field Integer >0 [SOLVED]

karmine 24 Mar, 2010
A request .... for Gray Head or anyone who has patience...
I want a field (required) in a form that is a number integer, but is different from zero ...
What should I do?
(the solution is god in php or javascript)

Thank you so much always

Carmine
GreyHead 25 Mar, 2010
Hi Carmine,

Sorry, I don't understand the question - is this about the field default value, or validation, or something else?

Bob
karmine 25 Mar, 2010
:P You're right, sorry ...
I want a field that can contain only integers (no comma) and is greater than zero
-----------
(the validation in javascript o php o native chronoform)
-----------
Thanks again
GreyHead 25 Mar, 2010
Hi Carmine,

I think that if you use 'validate-digits' and 'required' together it will work, if not there are some examples here of custom validations using regular expressions.

Bob
karmine 25 Mar, 2010
MMM but ...if i use 'validate-digits' and 'required' together ... I do not get even greater than zero?
How do I use a regular expression for ...."is a number but not zero?"
I know this is stupid but I can not ...

Thank you for your willingness BOB
GreyHead 26 Mar, 2010
Hi Carmine,

I checked the LiveValidation docs here and it looks as though that might be more useful. There are several posts here about setting up custom LiveValidations.

Bob
karmine 26 Mar, 2010
I write my solution ...

Thanks Bob

[SOLVED]
 
<input class="cf_inputbox required" maxlength="30" size="12" title="Insert a total" id="text_6" name="totalefatt" type="text"/>
<script type="text/javascript">
   var text_6 = new LiveValidation('text_6');
   text_6.add(Validate.Numericality, { minimum: 0, maximum: 9999999 } );
</script>



I have included liveValidation in javascript code.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger