ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

Validation not firing in Firefox or IE

bruceb 04 Feb, 2009
Hi, I have code on my connectivity form on the "Record Edit Template" on the Front Permissions tab. The problem is the validations are not firing and I just cannot figure out why....is there something i've missed? I Hope i'm not being stupid somewhere. 😶 Thanks for the help....
<style>
    .validation-advice
    {
        color: red;
        font-size: smaller;
    }
    .cf_inputbox
    {
        font-size: smaller;
        width: 140px;
    }
</style>

<strong style="font-family: 'Times New Roman', Times, serif; font-size: large; color: #800000">
    Edit Reservation</strong> ( * = Required field )</strong>
        <hr />
    <p></p>
<table border="0" cellpadding="1" cellspacing="3" style="border-style: ridge">
    <tr>
        <td width="120px">
            Date of Flight* :
        </td>
        <td width="180px">
            <input onclick="new Calendar(this);" class="cf_datetime required" size="10" id="date_of_flight"
                name="date_of_flight" type="text" style="font-size: smaller" />
        </td>
        <td width="190px">
            Time Slot Requested* :
        </td>
        <td width="180px">
            <select class="cf_inputbox validate-selection" id="time_slot" size="1" name="time_slot">
                <option value="">Time Slot</option>
                <option value="07:00 - 09:00">07:00 - 09:00</option>
                <option value="09:00 - 11:00">09:00 - 11:00</option>
                <option value="11:00 - 13:00">11:00 - 13:00</option>
                <option value="13:00 - 15:00">13:00 - 15:00</option>
                <option value="15:00 - 17:00">15:00 - 17:00</option>
            </select>
        </td>
    </tr>
    <tr>
        <td colspan="2">
        </td>
        <td style="color: #000080">
            Actual Flight Time* :
        </td>
        <td>
            <select class="cf_inputbox validate-selection" id="flight_hour" size="1" name="flight_hour"
                style="width: 50px">
                <option value="">HH</option>
                <option value="06">06</option>
                <option value="07">07</option>
                <option value="08">08</option>
                <option value="09">09</option>
                <option value="10">10</option>
                <option value="11">11</option>
                <option value="12">12</option>
                <option value="13">13</option>
                <option value="14">14</option>
                <option value="15">15</option>
                <option value="16">16</option>
                <option value="17">17</option>
                <option value="18">18</option>
            </select>
            :
            <select class="cf_inputbox validate-selection" id="flight_minute" size="1" name="flight_minute"
                style="width: 50px">
                <option value="">MM</option>
                <option value="00">00</option>
                <option value="15">15</option>
                <option value="30">30</option>
                <option value="45">45</option>
            </select>
        </td>
        </td>
    </tr>
    <tr>
        <td colspan="4">
        </td>
    </tr>
    <tr>
        <td>
            <p class="form">
            Type of Flight* :
        </td>
        <td>
            <select class="cf_inputbox validate-selection" id="type_of_flight" size="1" name="type_of_flight">
                <option value="">Select a Flight</option>
                <option value="Short Scenic">Short Scenic</option>
                <option value="Long Scenic">Long Scenic</option>
                <option value="Champagne Flight">Champagne Flight</option>
                <option value="Combo Flight">Combo Flight</option>
                <option value="Other">Other</option>
            </select>
        </td>
        <td>
            Seats Required* :
        </td>
        <td>
            <input class="cf_inputbox required validate-digits" maxlength="2" size="2" id="seats"
                name="seats" type="text" />
        </td>
    </tr>
    <tr>
        <td>
            Place of Pickup* :
        </td>
        <td>
            <select class="cf_inputbox" validate-selection id="Select1" size="1" name="pickup_point">
                <option value=""></option>
                <option value="Self Drive">Self Drive</option>
                <option value="Livingstone Area">Livingstone Area</option>
                <option value="David Livingstone Lodge">David Livingstone Lodge</option>
                <option value="Royal Livingstone Hotel">Royal Livingstone Hotel</option>
                <option value="Zambezi Sun">Zambezi Sun</option>
            </select>
        </td>
        <td style="color: #000080">
            Booking Status* :
        </td>
        <td>
            <select class="cf_inputbox" validate-selection id="bookingstatus" size="1" name="bookingstatus">
                <option value=""></option>
                <option value="Provisional">Provisional</option>
                <option value="Confirmed">Confirmed</option>
                <option value="Flight Completed">Flight Completed</option>
            </select>
        </td>
    </tr>
    <tr>
        <td style="color: #000080">
            Aircraft* :
        </td>
        <td colspan="2">
            <select class="cf_inputbox" validate-selection id="aircraft" size="1" name="aircraft">
                <option value=""></option>
                <option value="9J-OAH">6 Seater</option>
                <option value="9J-UAC">4 Seater</option>
            </select>
        </td>
        <td>
            
        </td>
    </tr>
    <tr>
        <td>
            Name* :
        </td>
        <td>
            <input class="cf_inputbox required" maxlength="150" size="40" id="fullname" name="fullname"
                type="text" />
        </td>
        <td>
            Address 1 :
        </td>
        <td>
            <input class="cf_inputbox" maxlength="150" size="40" id="address1" name="address1"
                type="text" />
        </td>
    </tr>
    <tr>
        <td>
            Phone* :
        </td>
        <td>
            <input class="cf_inputbox required validate-number" maxlength="150" size="40" id="phone"
                name="phone" type="text" />
        </td>
        <td>
            Address 2 :
        </td>
        <td>
            <input class="cf_inputbox" maxlength="150" size="40" id="address2" name="address2"
                type="text" />
        </td>
    </tr>
    <tr>
        <td>
            Email* :
        </td>
        <td>
            <input class="cf_inputbox required validate-email" maxlength="150" size="40" id="email"
                name="email" type="text" />
        </td>
        <td>
            Country :
        </td>
        <td>
            <input class="cf_inputbox" maxlength="150" size="40" id="country" name="country"
                type="text" />
        </td>
    </tr>
    <tr>
        <td colspan="4">
        </td>
    </tr>
</table>
Max_admin 04 Feb, 2009
Hi bruceb,

Connectivity doesn't have the validation of Chronoforms, you need to do this manually! 🙄

I mean you need to include the validation files to the page and use the same technique with classes.

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
bruceb 05 Feb, 2009
Thanks for the reply, I started trying your suggestion yesterday after making the original post. At this stage I have included everything from "soup to nuts" pointing to the files/scripts and stylesheets used in the chrono form and i still can't get it to work. Could you possibly give me an example of what/how you would include in the code i showed above. Many thanks once again.
Max_admin 05 Feb, 2009
no problems, do you have the page online somewhere so that I can look at ? you only need to reference the files, it should be something like this:

<script type="text/javascript" src="http://www.site.com/components/com_chronocontact/js/mooValidation.js">
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
GreyHead 06 Feb, 2009
Hi bruceb,

Or better
<?php
$doc =& JFactory::getDocument();
$doc->addScript("http://www.site.com/components/com_chronocontact/js/mooValidation.js");
?>
Which will load in the page header rather than in the middle of the page.

Bob
bruceb 06 Feb, 2009
Thanks Bob, doesn't work, but at least i get an error that might mean something...

Class is not defined
http://sitename.co.za/components/com_chronocontact/js/mooValidation.js
Line 10

....and....

Calendar is not defined
http://sitename.co.za/UAC/index.php?option=com_chronoconnectivity&connectionname=PendingReservations&task=editrecord&cids=4&Itemid=72/event/ZwoJ5FrAFcuzyeL8%2FuTj5A%3D%3D
Line 2

this is after doing this

<?php
$doc =& JFactory::getDocument();
$doc->addStyleSheet("http://sitename.co.za/components/com_chronocontact/css/style1.css");
$doc->addStyleSheet("http://sitename.co.za/components/com_chronocontact/css/calendar.css");
$doc->addStyleSheet("http://sitename.co.za/components/com_chronocontact/css/tooltip.css");
$doc->addScript("http://sitename.co.za/omponents/com_chronocontact/css/calendar.js");
$doc->addScript("http://sitename.co.za/components/com_chronocontact/js/mooValidation.js");
?>

I'm lost 😶 😶
GreyHead 06 Feb, 2009
Hi Bruce,

I think there are a couple of snippets in the page that are still needed - I'll go take a look.

If the page is online please pm me a link to go take a look.

Bob

PS There's a type in the calendar line - but that could be from changing the domain name.
GreyHead 06 Feb, 2009
Hi Bruce,

ChronoForms adds this script to every form
function formCallback(result, form) {
  window.status = "validation callback for form '" + form.id + "': result = " + result;
}
var valid = new Validation('<?php echo "ChronoContact_".$rows[0]->name; ?>', {
    immediate : true, 
    useTitles : true, 
    onFormValidate : formCallback
});
I've never been completely sure how this works. I think that the first part just writes a message to the Browser status bar. Clearly you need to insert the form_name in the new Validation part and I think that the rest sets options for the validation.

Let's try skipping the status bar message and use:
$validation = "var valid = new Validation('".##form_name##."', { immediate : true, useTitles : true });";
$doc->addScript Declaration($validation);
but the ".##form_name##." need to be replace with the ChronoConnectivity form name.

Bob


Bob
GreyHead 06 Feb, 2009
Hi Bruce,

Having looked at the page try:
$validation = "var valid = new Validation('PendingReservations', { immediate : true, useTitles : true });";
$doc->addScriptDeclaration($validation);
Bob
bruceb 06 Feb, 2009
Yes, that gives me the ...

Parse error: syntax error, unexpected T_STRING in /UAC/components/com_chronoconnectivity/chronoconnectivity.html.php(283) : eval()'d code on line 9
Max_admin 06 Feb, 2009
Hi Bruce,

we will edit Bob's code alittle, try this instead:

    $validation = "<script type=\"text/javascript\">var valid = new Validation('PendingReservations', { immediate : true, useTitles : true });</script>";
    $doc->addCustomTag($validation);

the line above must go after all this:
<?php
$doc =& JFactory::getDocument();
$doc->addStyleSheet("http://sitename.co.za/components/com_chronocontact/css/style1.css");
$doc->addStyleSheet("http://sitename.co.za/components/com_chronocontact/css/calendar.css");
$doc->addStyleSheet("http://sitename.co.za/components/com_chronocontact/css/tooltip.css");
$doc->addScript("http://sitename.co.za/omponents/com_chronocontact/css/calendar.js");
$doc->addScript("http://sitename.co.za/components/com_chronocontact/js/mooValidation.js");
?>

let me know!

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
bruceb 06 Feb, 2009
Just to confirm, I have this...

<?php
$doc =& JFactory::getDocument();
$doc->addStyleSheet("http://sitename.co.za/UAC/components/com_chronocontact/css/style1.css");
$doc->addStyleSheet("http://sitename.co.za/UAC/components/com_chronocontact/css/calendar.css");
$doc->addStyleSheet("http://sitename.co.za/UAC/components/com_chronocontact/css/tooltip.css");
$doc->addScript("http://sitename.co.za/UAC/components/com_chronocontact/css/calendar.js");
$doc->addScript("http://sitename.co.za/UAC/components/com_chronocontact/js/mooValidation.js");
$validation = "<script type=\"text/javascript\">var valid = new Validation('PendingReservations', { immediate : true, useTitles : true );</script>";
$doc->addCustomTag($validation);
?>

Which gives this...

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /UAC/components/com_chronoconnectivity/chronoconnectivity.html.php(283) : eval()'d code on line 8

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /UAC/components/com_chronoconnectivity/chronoconnectivity.html.php(283) : eval()'d code on line 8

Sorry chaps...those quote unquotes have me seeing double... 😀
Max_admin 06 Feb, 2009
Ok, lets edit the code, sometimes small things make it alittle annoying!🙄

    <?php
    $doc =& JFactory::getDocument();
    $doc->addStyleSheet("http://sitename.co.za/UAC/components/com_chronocontact/css/style1.css");
    $doc->addStyleSheet("http://sitename.co.za/UAC/components/com_chronocontact/css/calendar.css");
    $doc->addStyleSheet("http://sitename.co.za/UAC/components/com_chronocontact/css/tooltip.css");
    $doc->addScript("http://sitename.co.za/UAC/components/com_chronocontact/css/calendar.js");
    $doc->addScript("http://sitename.co.za/UAC/components/com_chronocontact/js/mooValidation.js");
    $validation = '<script type='"text/javascript">
var valid = new Validation("PendingReservations", { immediate : true, useTitles : true );
</script>';
    $doc->addCustomTag($validation);
    ?>

let me know!

Cheers,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Max_admin 06 Feb, 2009
please add www. before sitename too!😉 and I guess you have Chronoforms installed, correct ?
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
bruceb 06 Feb, 2009
please add www. before sitename too!😉 and I guess you have Chronoforms installed, correct ?
Affrimative 😀 😀 ...php still getting lost with quotes in code from above ...

Parse error: syntax error, unexpected T_STRING in /home/bruce846/public_html/UAC/components/com_chronoconnectivity/chronoconnectivity.html.php(283) : eval()'d code on line 23
GreyHead 06 Feb, 2009
Hi Bruce,

I'm now really confused - there doesn't seem to be a line 23 in the code you posted.

Bob

PS There was an extra space in my code it should be $doc->addScriptDeclaration($validation); with no spaces
bruceb 06 Feb, 2009
So after a lot of trial and error, i finally got php to parse the declaration. This is the code i have now...

<?php
$doc =& JFactory::getDocument();
$doc->addStyleSheet("http://www.lightsketch.co.za/UAC/components/com_chronocontact/css/style1.css");
$doc->addStyleSheet("http://www.lightsketch.co.za/UAC/components/com_chronocontact/css/calendar.css");
$doc->addStyleSheet("http://www.lightsketch.co.za/UAC/components/com_chronocontact/css/tooltip.css");
$doc->addScript("http://www.lightsketch.co.za/UAC/components/com_chronocontact/css/calendar.js");
$doc->addScript("http://www.lightsketch.co.za/UAC/components/com_chronocontact/js/mooValidation.js");
$validation = '<script type="text/javascript">var valid = new Validation("PendingReservations", { immediate : true, useTitles : true } );</script>';
$doc->addScriptDeclaration($validation);
?>

This however throws the following javascript errors

Class is not defined
http://www.lightsketch.co.za/UAC/components/com_chronocontact/js/mooValidation2.js
Line 10

missing } in XML expression
http://lightsketch.co.za/UAC/index.php?option=com_chronoconnectivity&connectionname=PendingReservations&task=editrecord&cids=4&Itemid=72
Line 21

Calendar is not defined
http://lightsketch.co.za/UAC/index.php?option=com_chronoconnectivity&connectionname=PendingReservations&task=editrecord&cids=4&Itemid=72/event/ZwoJ5FrAFcuzyeL8%2FuTj5A%3D%3D
Line 2

I can't see anything wrong when looking at the html source. Throw in the towel?

I will leave the "Record Edit Template: " as is for now.
GreyHead 06 Feb, 2009
Hi Bruce,

You've probably got double script tags in the declaration. Try:
$validation = 'var valid = new Validation("PendingReservations", { immediate : true, useTitles : true } );';
$doc->addScriptDeclaration($validation);

Bob

PS Max's addCustomTag() needs them, my addScriptDeclaration() doesn't.
bruceb 07 Feb, 2009
Thanks for all the help guys but I still can't get it working. I've tried all iterations and modified all submitted code but still nothing. So I will leave the form without validation for now while I demo the site to my employer.

Can I make a suggestion that validation be added in future releases?
GreyHead 07 Feb, 2009
Hi Bruce,

Thanks for giving it a good try, I'm sure that Max will look at it for a future release. If I get some free time I'll have a go and see if I can get it working and post here if I do.

Bob
This topic is locked and no more replies can be posted.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com