Hi everybody,
I created form.the form fields records are saved in database.if select
<div id="privacy_create" > this field add some datas in another table [PrivacyProfilePlanpeople]
i have no issue.but records store only in first table.
privacyprofileplanpeople table no records are added.
what is the problem.
anybody plz help me.
public function executeEdit(sfWebRequest $request)
{
$meetnewpeople=Doctrine_Core::getTable('Meetnewpeople')->find(array($request->getParameter('id')));
$this->form = new MeetnewpeopleForm();
$create_meetnewpeople = new Meetnewpeople();
$this->layers = $this->personal->getLayer();
if($request->isMethod('post'))
{
$this->layers = $this->personal->getLayer();
$create_record = $request->getParameter('meetnewpeople');
$create_record['personal_id'] = $this->getUser()->getAttribute('detail')->getId();
//var_dump($create_record['personal_id']);
if($request->hasParameter('_doneplan'))
{
$create_record['draft'] = 1;
if(is_array($create_record))
$obj_meetnewpeople=$create_meetnewpeople->saveRecord($create_record);
//$create_meetnewpeople->setDraft(1);
}
else if($request->hasParameter('_saveplan'))
{
$create_record['draft'] = 2;
if(is_array($create_record))
$obj_meetnewpeople=$create_meetnewpeople->saveRecord($create_record);
}
else
{
$create_record['draft'] = 0;
if(is_array($create_record))
$obj_meetnewpeople = $create_meetnewpeople->saveRecord($create_record);
}
$meetnewpeople = Doctrine::getTable("Meetnewpeople")->find($request->getParameter("id"));
$create_meetnewpeople = $create_meetnewpeople->getDataInArray();
$peopleprivacy=$request->getParameter('Peopleprivacy');
$relativeId=$request->getParameter("friendId");
//if(isset($peopleprivacy))
// {
// if($peopleprivacy[2] =="layerpeople")
// {
$creatorId=$this->getUser()->getAttribute('detail')->getId();
$relativeId=$request->getParameter("friendId");
$meetnewpeopleId=$obj_meetnewpeople['id'];
var_dump($meetnewpeopleId);
$type="plan";
$is_allowed="1";
$privacypeople= Doctrine::getTable("PrivacyProfilePlanpeople")->savePlanPrivacy($creatorId,$meetnewpeopleId,$relativeId,$type);
//$privacypeople_obj= Doctrine_Query::create()->select('p.id,p.relativeId')->from('PrivacyProfilePlanpeople p');
//var_dump($privacypeople_obj);
//}
//}
}
}
<div>
<form action ="<?php echo url_for('@meetnewpeople_edit') ?>" id="meetnewpeople" method="post" enctype="multipart/form-data" >
<div id="privacy" class="create-privacy" >
<div id="privacy_create" >
<input type="checkbox" value="people" name="Peopleprivacy[]" />Only people in this plan can see <br><br>
<input type="checkbox" value="friends" name="Peopleprivacy[]" /> All Friends can see
</div>
<div id="hidefrom" name="peopleprivacy[]",value="layerpeople", class="float-left"><b>HideFrom</b>
<div class="field">
<select id="privacy_layer_id" name="privacy[layer_id]" class="layer-people-select" target="layer_people_id">
<option value="">[Select]</option>
<?php foreach ($layers as $layer): ?>
<option value="<?php echo $layer->getId() ?>" <?php if ($layer["id"] == $layer->getId()) echo "selected" ?>><?php echo $layer->getName() ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="field">
<select id="layer_people_id" name="layer[people_id]" style="width:200px;">
<option value="">[Select]</option>
</select>
</div>
</div>
</div>
<a href="#" id="privacy_popup">Privacy</a>
<table border="0" cellpadding="0" cellspacing="0" class='meetnewpeople'>
<tr><td><?php echo $form['date']->renderLabel(). ":" ;?><?php echo $form['date']->render() ; ?></td></tr>
<tr><td> <?php echo $form['plantitle']->renderLabel().":"; ?><?php echo $form['plantitle']->render() ;?></td></tr>
<tr><td><?php echo $form['photo']->renderLabel().":";?><?php echo $form['photo']->render() ;?></td></tr>
<tr><td colspan='2' style="text-align:left;padding-left:60px;">
<p class="caption">About Plan</p> <td><?php echo $form['about_plan']->render(array('class'=>'field')) ;?></td></tr>
<tr><td><?php echo $form['plantype']->renderLabel().":" ;?><?php echo $form['plantype']->render() ?></td></tr>
<tr><td><?php echo $form['country_id']->renderLabel(). ":" ;?><?php echo $form['country_id']->render();?> </td></tr>
<tr><td><?php echo $form['zone_id']->renderLabel(). ":" ;?><?php echo $form['zone_id']->render();?> </td></tr>
<tr><td><?php echo $form['city']->renderLabel().":" ;?><?php echo $form['city']->render() ;?></td></tr>
<tr><td><?php echo $form['meetingpoint']->renderLabel().":" ;?><?php echo $form['meetingpoint']->render() ;?></td></tr>
<tr><td><span class= "field_label"> PlanCapacity</span> <?php echo $form['noofpeople']->render() ;?></td></tr>
<tr><td><input type="submit" id="planbar" value="+ " class='btn_class' />
<div id="planbars" class="float-left" >
</div></td></tr><br>
<tr><td><?php echo $form['time']->renderLabel().":" ;?><?php echo $form['time']->render() ;?></td></tr>
<tr><td><?php echo $form['what']->renderLabel().":" ;?><?php echo $form['what']->render() ;?></td></tr>
<tr><td><?php echo $form['Where_go']->renderLabel().":" ;?><?php echo $form['Where_go']->render() ;?></td></tr>
<tr><td><?php echo $form['who']->renderLabel().":" ;?><?php echo $form['who']->render() ?></td>
<tr><td><div id="privacy_layerpeople" class="people-select">
<div class="field">
<select id="privacy_layer_id" name="privacy[layer_id]" class="layer-people-select" target="layer_people_id">
<option value="">[Select]</option>
<?php foreach ($layers as $layer): ?>
<option value="<?php echo $layer->getId() ?>" <?php if ($layer["id"] == $layer->getId()) echo "selected" ?>><?php echo $layer->getName() ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="field">
<select id="layer_people_id" name="layer[people_id]" style="width:200px;">
<option value="">[Select]</option>
</select>
</div>
</div>
</div></td></tr>
<td><div id="notify-friend" >
</div></td></tr> <tr><td colspan="2" style="text-align: center"><input type="submit" value="Save" name="_saveplan" class='btn_class' /></td>
</tr>
<td><input type="submit" value="done" name ="_doneplan" class='btn_class' /></td>
<td><input type="submit" value="send" name ="_sendplan" class='btn_class' /></td></tr>
</table>
</form>
$("select[id='layer_people_id']").change(function() {
var Id =$(this).val();
$.ajax({
type: 'POST',
cache : false,
url: "http://localhost/public_html/web/meetnewpeople/edit",
data: { friendId: Id},
success: function(data) {
//alert('Friends Successfully Selected!');
alert(Id );
}
});
});