Republish Error HELP

about2flip 28 Mar, 2011
Hi,

I am using server side validation, and I am using the republish option as suggested in the 3.1 cookbook. However, I am getting this error. Please help

Warning: preg_replace() [function.preg-replace]: Unknown modifier '>' in /home/paying/public_html/paypeople/components/com_chronocontact/libraries/includes/JSrepublish.php on line 102
GreyHead 28 Mar, 2011
Hi about2flip ,

That looks like te code to republish a textarea - do you know what values are in the textareas in your form?

Bob
about2flip 28 Mar, 2011
Yes I do. Right now I just started with one line just to test, and I still get the error. This is my validation code, is there anything wrong with this? I got it out of the 3.1 cookbook

<?php
$messages = array();
$fname = JRequest::getString('fname', '', 'post' );
if ( !$fname ) { $messages[] = "Please enter first name";
}
if ( count ($messages) ) { 
return implode ('<br />', $messages);
}
?>


This is the code from first name textbox.
<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">First Name</label>
    <input class="cf_inputbox required" maxlength="50" size="50" title="Please enter your first name" id="text_1" name="fname" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>
GreyHead 28 Mar, 2011
Hi about 2flip,

Hmmm . .. theres no sign of a textarea there :-(

Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.

Bob
about2flip 28 Mar, 2011
I started from scratch and the error is gone, so I am going through it line by line. I hit a snag with this line:

$pattern = '/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2, })$/i';
if ( !preg_match($pattern, $email) ) { $messages[] = "Please enter a valid email address in the email box.";

I have a proper email address. [email]name@email.com[/email], and it is giving me the Please enter a valid email address...... error. Did I type the pattern correctly, again I got it out of the 3.1 cookbook.

Thanks Again Bob
GreyHead 28 Mar, 2011
Hi about2flip,

Make that
$pattern = '/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,6})$/i';
That's with 2,6 near the end.

If that still causes problems try changing the separators to #
$pattern = '#^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,6})$#i';
as the slashes sometimes get in the way.

Bob

PS I'll report my typo in the book to the publisher so that it goes on the erratum list. Sorry about that.
about2flip 28 Mar, 2011
Thanks. The first one worked by adding the 6. I found the line causing my error, and Im going to cry.

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 150px;">State*</label>
    <div id="getStates"> <select name="statename" />
    <option value="">select a country</option></select></div>
    
  </div>
  <div class="cfclear"> </div>
</div>


This is from the http://chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=7&t=19272&p=66682&hilit=country+drop+down#p66682

I need this part to work is there anyway to get this work. PLEASE
This topic is locked and no more replies can be posted.