RE: [PEAR] quickform regex help
| From: | Mike Carter | Date: | Fri, 16 Jan 2004 14:39:04 +0000 |
| Subject: | RE: [PEAR] quickform regex help | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10180@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Everett Michaud [mailto:emichaud@sequoianet.com]
>
> Two quick questions regarding using rules in quick form:
> 1. How would I write a regex to prohibit any spaces in a text
> field. I want
> a string that does not have spaces and would like to check this upon
> submission.
There's a couple of built in regexs. One allows both letters and numbers.
'lettersonly' => '/^[a-zA-Z]+$/',
'alphanumeric' => '/^[a-zA-Z0-9]+$/',
> 2. Is there a way to add a rule to quickform that simply does a yes/no
> confirm and if yes is pressed, continues the submit process.
> This is for
> forms that are about to do something serious - like adding or
> deleting a
> record - to ask the user - "are you sure?".
Just add an onclick event to your button. I do this for my cancel buttons.
Regards,
Mike C.