This topic is locked

field telephone registration and identity

6/22/2010 10:35:03 PM
PHPRunner General questions
O
onlline author

You do not need a mask for the following fields
Field Phone (31) 8843-4040

Field CNPJ 12.104.680/0001-72

Field identity 11,628,167
need to enter always be that way

that the user is required to enter the numbers and that is the right amount
Camp phone (xx) xxxx-xxxx

Field xx.xxx.xxx CNPJ / xxxx-xx

Field identity xx.xxx.xxx
PHPRUNNER 5.2 5482

A
ann 6/23/2010

Leonardo,
to add brackets and slashes on the fly (when user is entering phone number) you need to add custom Javascript code in JavaScript Onload Event on the Events tab.

Here is just a sample:

var ctrl = Runner.getControl(pageid, 'FieldName');

function func() {

//add your code here

};

ctrl.on('keyup', func);


Here are the samples:

http://www.webresourcesdepot.com/javascript-input-masks/

http://digitalbush.com/projects/masked-input-plugin/

M
marthins 6/23/2010

Leonardo,
I used the following masks:
Check if number is CNPJ or CPF:

if (strlen($value)==11){



$value= substr($value,0,3) . "." . substr($value,3,3) . "." . substr($value,-5,3). "-" . substr($value,-2);
}else if (strlen($value)==14){

$value= substr($value,0,2) . "." . substr($value,2,3) . "." . substr($value,5,3). "/" . substr($value,8,4)."-" . substr($value,-2);

}


For telephone number I have area code and number separated:

if (strlen($value)==8)
{
$value = substr($value,0,4) . "-" . substr($value,4) ;
}


Hope this helps.
Anselmo

O
onlline author 6/23/2010



Leonardo,
to add brackets and slashes on the fly (when user is entering phone number) you need to add custom Javascript code in JavaScript Onload Event on the Events tab.

Here is just a sample:

var ctrl = Runner.getControl(pageid, 'FieldName');

function func() {

//add your code here

};

ctrl.on('keyup', func);


Here are the samples:

http://www.webresourcesdepot.com/javascript-input-masks/

http://digitalbush.com/projects/masked-input-plugin/


did not work.
var ctrl = Runner.getControl(pageid, 'Total');

function func() {

//add your code here
jQuery(function($){

$("#Total").mask("(999) 999-9999");

});
};

ctrl.on('keyup', func);

O
onlline author 6/23/2010



Leonardo,
I used the following masks:
Check if number is CNPJ or CPF:

if (strlen($value)==11){
$value= substr($value,0,3) . "." . substr($value,3,3) . "." . substr($value,-5,3). "-" . substr($value,-2);
}else if (strlen($value)==14){

$value= substr($value,0,2) . "." . substr($value,2,3) . "." . substr($value,5,3). "/" . substr($value,8,4)."-" . substr($value,-2);

}


For telephone number I have area code and number separated:

if (strlen($value)==8)
{
$value = substr($value,0,4) . "-" . substr($value,4) ;
}


Hope this helps.
Anselmo


Oi Anselmo! aonde coloco esse trecho de codigo?
Orbrigado

M
marthins 6/23/2010

Leonardo,
You should put this code on field properties -> "view as" settings -> custom.
Abçs
Anselmo

O
onlline author 6/23/2010



Leonardo,
You should put this code on field properties -> "view as" settings -> custom.
Abçs
Anselmo


Não deu certo!
minha verão é a 5.2 5482

M
marthins 6/23/2010

Leonardo,
Go to the List page, double click on the field you want to modify (or select properties), select "view as" tab and finally "Custom". Just copy and paste the code I mentioned. Please note that for CPF and CNPJ the mask will work only for 11 and 14 characters and the phone field for 8. If you want to use with any number dont check the lenght of the field.
Abraços
Anselmo

O
onlline author 6/23/2010



Leonardo,
Go to the List page, double click on the field you want to modify (or select properties), select "view as" tab and finally "Custom". Just copy and paste the code I mentioned. Please note that for CPF and CNPJ the mask will work only for 11 and 14 characters and the phone field for 8. If you want to use with any number dont check the lenght of the field.
Abraços
Anselmo


as instruções são simples.

mas realmente nao aparece a mascara.
instructions are simple.

but it really does not appear to mask.

O
onlline author 6/24/2010



as instruções são simples.

mas realmente nao aparece a mascara.
instructions are simple.

but it really does not appear to mask.


I used these examples but I could not!
Here are the samples:

http://www.webresour...pt-input-masks/

http://digitalbush.c...d-input-plugin/

O
onlline author 6/24/2010

no work! help!
var ctrl = Runner.getControl(pageid, 'f_name');

function func() {
ctrl.setValue(this,event,'###.###.###-##');
};
ctrl.on('keyup', func);

A
ann 6/25/2010

Leonardo,
this code won't work because you can pass one parameter only in the setValue() method:

ctrl.setValue(custom_value);



You can check PHPRunner functions description here:

http://xlinesoft.com/phprunner/docs/javascript_api.htm
I suppose you need to format this value before and then assign result using setValue() method.

Also to use this constructions you need to download additional plugins and then include them into the library.
You can also try to insert the code into the HTMl code on the Visual Editor tab (exactly as it is done in the instructions on sites).
Unfortunately we don't have a ready to go solution for this.

O
onlline author 6/25/2010



Leonardo,
this code won't work because you can pass one parameter only in the setValue() method:

ctrl.setValue(custom_value);



You can check PHPRunner functions description here:

http://xlinesoft.com/phprunner/docs/javascript_api.htm
I suppose you need to format this value before and then assign result using setValue() method.

Also to use this constructions you need to download additional plugins and then include them into the library.
You can also try to insert the code into the HTMl code on the Visual Editor tab (exactly as it is done in the instructions on sites).
Unfortunately we don't have a ready to go solution for this.


Test this example of the help! also not work.
http://xlinesoft.com/phprunner/docs/_view_as__settings_custom.htm
2. Format 10-digit phone number into the following format (xxx) xxx-xxx .
PHP code:
if (strlen($value)==10)
{
$value="(" . substr($value,0,3) . ") " . substr($value,3,3) . "-" . substr($value,6);
}
############
when I would enter
telephone and identide stay easier to insert and display.
plugns tried abroad.
but most ask for the name of the form
example
<script type=text/javascript>

function mascara(e,src,mask) {

if(window.event) {

_TXT = e.keyCode;

} else

if(e.which) {

_TXT = e.which;

}

if(_TXT > 47 && _TXT < 58) {

var i = src.value.length;

var saida = mask.substring(0,1);

var texto = mask.substring(i);

if(texto.substring(0,1) != saida) {

src.value += texto.substring(0,1);

}

return true;

} else {

if (_TXT != 8) {

return false;

} else {

return true;

}

}

}

</SCRIPT>
<input type="text" size="20" name="telefone"

value="" onclick="javascript:getIt(this)" maxlength="13">

A
ann 6/28/2010

Leonardo,
the example from the manual is working on the test file. Name of the form is editform1.

O
onlline author 6/28/2010



Oi Anselmo! aonde coloco esse trecho de codigo?
Orbrigado


thanks Ann and Anselmo !
with this code solved the visualization!
Now I have a mask, when you begin typing in real time

example

O
onlline author 6/28/2010



Leonardo,
the example from the manual is working on the test file. Name of the form is editform1.


sorry!
need to know the name of the form. and the name of field.
example
<script>

function mascara(src, mask){

var i = src.value.length;

var saida = mask.substring(0,1);

var texto = mask.substring(i)

if (texto.substring(0,1) != saida)

{

src.value += texto.substring(0,1);

}

}

</script
<input type="text" name="phone" onkeypress="mascara(this,'#####-###')" />
this code above it creates a new field! I wanted to put this code is already in the field generated by PHPRunner
<input type="text" name="phone" onkeypress="mask(this,'#####-###')" />

E
ericholiveira 7/24/2010

Olá Leonardo,

Você conseguiu resolver o problemas das mascaras?? eu tenho utilizado funções em javascript para as paginas de adicionar e editar, fiz também uma modificação no arquivo commonfunctions.php para receber na edição em linha.... mas gostaria de fazer essa mascara na edição em linha via javascript assim nao teria que a cada novo campo de formatação ter que mexer no arquivo.
Também seria interessante uma nova versão do Phprunner trazer um campo de configuração do campo para colocar a chamada de eventos onkeypres onkeyup, etc



thanks Ann and Anselmo !
with this code solved the visualization!
Now I have a mask, when you begin typing in real time

example