Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2006
    Location
    Johannesburg,South Africa
    Posts
    598

    how to get numbers from a form text field using BreezingForms in Joomla?

    Does anyone know, or use BreezingForms, on Joomla?


    How do I get only numbers from a text field? i.e. a user types in R40, how do I only get the "40" part of it?

    I tried the following, but it just gives me "NaN" as response:

    PHP Code:
    function ff_Total12_validation(elementmessage)
    {
        
    ff_wendy_calculate12();
        if (
    element.value==0) {
            
    ff_validationFocus('Price12');
            return 
    message;
        } 
    // if
        
    return '';
    // ff_Total12_validation

    function ff_wendy_calculate12()
    {
        var 
    amount12 0;
        var 
    order12;
        var 
    price12;

        
    qty12 Number(ff_getElementByName('QTY12').value);
        
    price12 Number(ff_getElementByName('Price12').value);
        if (
    qty12 != ''amount12 += parseInt(qty12) * Number(parseInt(price12));

        
    ff_getElementByName('Total12').value Math.round(amount12*100)/100;
        
    ff_OrderTotalAmount_validation();

    // ff_wendy_calculate12 
    A few google searches suggest that the "Number()" function could do this, but it doesn't seem to work. I'm using Joomla 1.5.15 + BreezingForms 1.7.1 Stable (build 730) [Trinity]
    Last edited by SoftDux; 06-13-2010 at 01:01 PM.
    South African Web Hosting - http://www.SoftDux.co.za || SA WebHostingTalk - http://www.webhostingtalk.co.za

  2. #2
    Join Date
    May 2009
    Location
    Hull, UK.
    Posts
    911
    PHP Code:
    $string "1 Apple 2 Oranges";

    $new_string ereg_replace("[^0-9]"""$string); 
    This would give the output:
    12

    If that's the kind of thing you're looking for, I haven't however used breezing forms before.

  3. #3
    Join Date
    Mar 2006
    Location
    Johannesburg,South Africa
    Posts
    598
    Quote Originally Posted by -Karl- View Post
    PHP Code:
    $string "1 Apple 2 Oranges";

    $new_string ereg_replace("[^0-9]"""$string); 
    This would give the output:
    12

    If that's the kind of thing you're looking for, I haven't however used breezing forms before.
    Yes, I'm looking for something similar to ereg_replace, but that will work with BreezingForms.

    The code structure that BreezingForms uses seems like it could be JavaScript, but my JS knowledge isn't very good so I can't say. Look at the code here and you'll see what I mean: http://www.crosstec.de/support/index...ntclient&id=26
    South African Web Hosting - http://www.SoftDux.co.za || SA WebHostingTalk - http://www.webhostingtalk.co.za

  4. #4
    Join Date
    Mar 2006
    Location
    Johannesburg,South Africa
    Posts
    598
    Can anyone help me with this?
    South African Web Hosting - http://www.SoftDux.co.za || SA WebHostingTalk - http://www.webhostingtalk.co.za

Similar Threads

  1. Replies: 0
    Last Post: 06-13-2010, 10:31 AM
  2. Form Field Focus
    By icoso in forum Web Design and Content
    Replies: 2
    Last Post: 01-29-2007, 11:23 AM
  3. Form Text Field Widths style Problem
    By ePlanetDesign in forum Web Design and Content
    Replies: 3
    Last Post: 06-24-2005, 10:06 AM
  4. Text with quote marks in a text input field
    By okok in forum Programming Discussion
    Replies: 4
    Last Post: 07-31-2004, 01:17 PM
  5. Form Field and JavaScript...
    By mkalavitz in forum Web Design and Content
    Replies: 1
    Last Post: 03-08-2004, 08:17 AM

Related Posts from theWHIR.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •