This topic is locked
[SOLVED]

 Upper Case

4/6/2010 4:40:43 PM
PHPRunner General questions
R
rodny author

Hello,
I want to force my users to type in UPPER CASE when they enter a data in the text inputs of my forms. How do I use javascript or php to do that in my generated forms in PHPRunner 5.2?
Thank you
Rodny <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=14214&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />

vin7102 4/6/2010

Rodny,
There is really two ways to do this. If you just want to have a specific field appear in upper case in a list page or report page, this is the easiest method

To make the characters all appear in upper case, go to the list page, or add page and double click on the field that you want to be upper case and select the "view as" tab.

Select "custom" from the list on the left and enter this in the text field on the right:

$value = strtoupper($value);


If for other reasons you need the values to be actually written to the database in upper case, you will need to use an add page, "before record added" event and change that field's case to upper before the value is written to the DB.
Example below: Change the values "FieldName" to match the field name you want made to upper case

$values["FieldName"] = strtoupper($values["FieldName"]);


Hope this helps,
Vince

R
rodny author 4/6/2010



Rodny,
There is really two ways to do this. If you just want to have a specific field appear in upper case in a list page or report page, this is the easiest method

To make the characters all appear in upper case, go to the list page, or add page and double click on the field that you want to be upper case and select the "view as" tab.

Select "custom" from the list on the left and enter this in the text field on the right:

$value = strtoupper($value);


If for other reasons you need the values to be actually written to the database in upper case, you will need to use an add page, "before record added" event and change that field's case to upper before the value is written to the DB.
Example below: Change the values "FieldName" to match the field name you want made to upper case

$values["FieldName"] = strtoupper($values["FieldName"]);


Hope this helps,
Vince


Hi Vince,

Thank you for your reply, I'll actualy use it in the add page. However i'd like it to correct it as the user type in the text input.

Something like:

<input type="text" name="caps" size=40 value="" onChange="javascript:this.value=this.value.toUpperCase();">


Thank you
Rodny <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=49022&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

Admin 4/6/2010

Check Javascript API article in PHPRunner manual that explains how to add code to onchange function of any field on Add/Edit page.

R
rodny author 4/6/2010



Check Javascript API article in PHPRunner manual that explains how to add code to onchange function of any field on Add/Edit page.


It's not working. It is a error I reported before:
When I use this code in Javascript Onload event section and I ask to check syntax I get this error message: syntax error, unexpected T_VAR in line 1

and the generated page does not work
Hope you can help me.
Rodny

Admin 4/7/2010

We cannot help you without seeing your code. What's your code?

R
rodny author 4/7/2010



We cannot help you without seeing your code. What's your code?


It's solved!! I used CSS Style to solve it with this code in the Add Page: Javascript OnLoad event:



var ctrlNome = Runner.getControl(pageid, 'Nome');

ctrlNome.addStyle('text-transform: uppercase;');

ctrlNome.on('blur', function(e){

ctrlNome.addStyle('text-transform: uppercase;');

});


It works!!! great!
Rodny <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=49052&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />