This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » legacy support » symfony 1.0 » form_remote_tag fillin issue
form_remote_tag fillin issue [message #98838] Tue, 11 May 2010 09:06
scott_dev  is currently offline scott_dev
Messages: 40
Registered: August 2008
Member
I have following files

/-------------------------------------------------/
testoneAction.class.php
/-------------------------------------------------/

<?php

sfLoader::loadHelpers(array('I18N','Partial'));

class testoneAction extends sfAction

{

public function handleError()

{
$this->setLayout('layout');
return $this->renderText(get_partial('registerone', array('sf_request' => $this->getRequest())));
}



public function validate()

{

$ssFlag = true;

if($this->getRequest()->getMethod()== sfRequest::POST)

{
$this->getRequest()->setAttribute('fillin',array ('enabled' => true,'param' => array ('name' => 'frmregistration','converters' => array ('trim' =>array (0 => 'email'), ), ),), 'symfony/filter');

if($this->getRequestParameter('email') == '')

{

$this->getRequest()->setError('email', __('msg_required_email'));

$ssFlag = false;

}
else

{

if ( !preg_match ( "/^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*\s+&lt;(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3} )&gt;$|^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})$/ ", trim( $this->getRequestParameter('email'))) )

{

$this->getRequest()->setError('email', __('msg_invalid_email'));

$ssFlag = false;

}

}

}
return $ssFlag;
}



public function execute()

{
$this->setLayout('layout');

if($this->getRequest()->getMethod()== sfRequest::POST)

{
echo 12;
exit;


}

}

}

/-------------------------------------------------/
testoneSuccess.php
/-------------------------------------------------/

<div id="register">
<?php include_partial('registerone',array('sf_request' => $sf_request)); ?>
</div>

/-------------------------------------------------/
_registerone.php
/-------------------------------------------------/

<?php use_helper('Javascript', 'Validation');
echo form_remote_tag(array('url' => '/home/testone/',

'update' => array('success' => 'register', 'failure' => 'register')),

array('name'=>'frmregistration','id' => 'frmregistration'));
?>

<table width="100%" border="0" cellspacing="1" cellpadding="5">

<?php if($sf_request->hasError('email')): ?>

<tr class="form_error">

<td colspan="2"></td><td> <?php echo $sf_request->getError('email'); ?></td>

</tr>

<?php endif; ?>

<tr>
<td width="18%"></td>

<td width="28%" align="left" valign="middle"><b><?php echo __('cap_email_address','','client_User') ?>: </b><span class="red">*</span></td>

<td width="54%" align="left" valign="middle"><?php echo input_tag('email','',array('class'=>'textbox','tabindex'=>'1','maxlength'= >'50')); ?></td>

</tr>

<tr>
<td></td>

<td align="left" valign="middle">&nbsp;</td>

<td align="left" valign="middle"><div class="button">
<?php echo submit_tag(__('cap_continue','','client_User'),array('tabind ex'= >'4','maxlength'=>'30','title' => __('cap_continue','','client_User'))); ?></div></td>

</tr>

</table>

</form>



When i'm inputs wrong email address it dosen't fill up. Why?. What's wrong in code. It creates problem when we are rendering 2-3 partials in one success file

[Updated on: Tue, 11 May 2010 11:53]

Previous Topic:message à supprimer
Next Topic:sfMemCache problem - cached data does not expire
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software