Files
ExpenseCount/app/View/FBAction/create_group_expense.ctp
2026-06-25 13:03:45 +06:00

99 lines
3.4 KiB
PHP

<link rel="stylesheet" type="text/css" href="<?php echo CDN_URL;?>js/jquery-1.10.2.js" />
<link rel="stylesheet" type="text/css" href="<?php echo CDN_URL;?>js/jquery-ui.js" />
<link rel="stylesheet" type="text/css" href="<?php echo CDN_URL;?>css/jquery-ui.css" />
<?php
echo $this->Session->flash();
echo $this->Form->create(null, array('url' => array('controller' => 'Home', 'action' => 'createGroupExpense')));
?>
<span id="error_title"></span><br/>
<span id="error_YourName"></span><br/>
<span id="error_participants"></span><br/>
<span id="error_currency"></span><br/>
<span id="error_captcha"></span><br/>
<table>
<tr><td>Title(*) </td> <td><?php echo $this->Form->input('title',array('title' => 'Please provide title','label'=>false,'length'=>'200px','required'=>'false'));?> </td></tr>
<tr> <td>Your Name(*) </td> <td><?php echo $this->Form->input('YourName',array('YourName' => 'Please provide Your Name','label'=>false,'length'=>'200px','required'=>'false'));?> </td></tr>
<tr><td> Participants </td> <td><?php echo $this->Form->input('participants',array('title' => 'Please provide comma separator value','label'=>false,'length'=>'200px','required'=>'false'));?> </td></tr>
<tr><td>Currency(*) </td> <td><?php echo $this->Form->input('currency',array('label'=>false)) ;?> </td></tr>
<tr><td>Description </td> <td><?php echo $this->Form->textarea('description',array('rows' => '5', 'cols' => '45'));?> </td></tr>
<tr><td> </td> <td><?php echo $this->Html->image(array('controller' => 'Home', 'action' => 'get_captcha'),array('id' => 'captcha_image'));
echo $this->Html->link('Reload Captcha', 'javascript:void(0);',array('id' => 'reload')); ?> </td></tr>
<tr><td> Captcha(*) </td> <td><?php echo $this->Form->input('captcha',array('label'=>false));?> </td></tr>
<tr> <td colspan="2" style="text-align:center" ><?php echo $this->Form->end('Submit');?> </td></tr>
</table>
<script type="text/javascript">
$(document).ready(function(){
$('#reload').click(function() {
var captcha = $("#captcha_image");
captcha.attr('src', captcha.attr('src')+'?'+Math.random());
return false;
});
});
$(document).ready(function () {
$('#ExpenseCreateGroupExpenseForm').submit(function(){
//serialize form data
var formData = $(this).serialize();
//get form action
var formUrl = $(this).attr('action');
// $('#error_title').text("");
// $('#error_participants').text("");
$('#ExpenseCreateGroupExpenseForm').find('span').text("");
$.ajax({
type: 'POST',
url: formUrl,
data: formData,
success: function(data,textStatus,xhr){
// alert(data);
if(data == "+000"){
document.getElementById("ExpenseCreateGroupExpenseForm").submit();
} else{
var lineArray = data.split("#");
var totalLine = lineArray.length-1;
for(var i=0;i<totalLine;i++){
var msgArray = lineArray[i].split("|");
$('#error_'+msgArray[0]).text(msgArray[1]);
//alert(msgArray[0]);
//alert(msgArray[1]);
}
}
},
error: function(xhr,textStatus,error){
// alert(error);
}
});
return false;
});
});
</script>