CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 I want to use a store mask on a table.

Print topic Send  topic

Author Message
Francisco3945

Posts: 28
Posted: 02/03/2017, 5:23 AM

How to make?

table:

Type phone (type_id, description, mask)

Client (customer_id, name)

Client phone (smartphone_id, type_id, phone)

When I include the cleinte telephone, I use the mascara for the appropriate telephone type.
View profile  Send private message
eratech


Posts: 513
Posted: 02/11/2017, 11:21 PM

@Francisco3945 - sorry for the delay. Been off forums this year.

If I understand your question, you want to select a client phone number, retrieve the mask depending on the type, and change the validation of the input text box according to the type.

You *could* have a bunch of DLookups for each phone number, but that's boring. ;-)

I would suggest to include the 'type phone' table in the query when getting the Client and Client phone details so you have something like this:

select client.customer_id , client.name, client_phone.phone, type_phone.mask  
from client, client_phone, type_phone  
where client.customer_id = client_phone.customer_id  
and client_phone.type_id = type_phone.type_id 

Then in the 'Before Show' for the phone field (or the Form), change the textbox details to use the mask in the Regex validation action. To get the code I usually add the Action I want to use, then add a Custom Code, then go to 'code' view and copy the Action code into the Custom code and make my modifications (and delete the Action code through the GUI so CCS can make it's changes)

So if you were storing a regular expression in the 'mask' field, and putting it in a hidden_mask textbox, you might have something like:

> Before Show

if (CCStrLen($Container->phone->GetText()) && !preg_match($Container->hidden_phone_mask->GetText(), $Container->phone->GetText())) {
$Container->phone->Errors->addError("Check phone number format");
}

Alternatively you can do something similar on the front end in javascript using the 'Input Mask' property of the Validate Entry (see Manual)

You can still retrieve the mask setting in the query, but pass the mask into a JS validation function that does the checking (see CCS 'Attributes' on how to add bits of data to the HTML or javascript , or even using things like HTML5 'data' attributes.)

Cheers

Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message
Francisco3945

Posts: 28
Posted: 02/13/2017, 3:24 AM


Thank you.

Here in brazil we have two types of telephone, residential and cellular with different masks.

Residential (00) 0000-0000
Cell phone (00) 00000-0000

And in the form now we will use residential ora cellular

Client (id_customer, name_customer)

Phone (id_phone, phone, id_type_phone)

Mask (id_type_phone, mask)

I can not see how to use the masks as I said ...
View profile  Send private message
Francisco3945

Posts: 28
Posted: 02/13/2017, 8:57 AM


Even thought of something using aucomplete and autofill
View profile  Send private message
Francisco3945

Posts: 28
Posted: 02/14/2017, 9:41 AM


Hi, I was able to do it using autocomplete and autofill, I am validating according to the regular expression registered along with the type of the phone. It was really cool.

The only thing I could not do was the mask.

you can help me? :-D
View profile  Send private message
eratech


Posts: 513
Posted: 02/16/2017, 2:38 AM

Good work - if you already have some regex and don't want to set the validation like my example (above, the Before Show) there are some jQuery masks that make things a bit easier to handle,

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

Which handles input entry masking and gives some tips for entry.

Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message
Francisco3945

Posts: 28
Posted: 02/16/2017, 3:10 AM

Thanks again.

Would you have an example of this library (source) inserted in the codecharge studio? It would help me a lot, I'm new to codecharge and I still do not know how to use it ...

As for the phone, sometimes it can be a fixed, sometimes it's a cell phone and they use different masks.
View profile  Send private message
Francisco3945

Posts: 28
Posted: 02/16/2017, 5:05 AM

I was young. It was very good;



Another thing you could help me with is how to work with tabs on the codecharge. Would you have a sample project for me?

Example: customer | requests
Data data
Customer requests
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.