I have been trying to implement edit/add of rows in jqgrid dynamically but stuck at place with editUrl attribute. Can somebody tell me that
1) Where to keep this php file, in server or in our applcation?
2) I am using like editurl: './data_save.php', and I have this file in my application, next to my jsp file. But on submit, I am getting 'error Status: 'Not Found'. Error code: 404' on top of popup window and on console I am getting, no mapping found for request with URI [/myapp/some.php] in distacherservlet with name 'myApp'.
Any idea?
Update :-
I also tried using, editurl:'/some.jsp' and when I create on controller(expecting this url) in my Spring MVC Controller class then I do not get message at console saying, "no mapping found for request with URI [/myapp/some.php] in distacherservlet with name 'myApp'"
Use your application name
editUrl:'WhatEverYourApplicationNameIs/data_save.php'
Update1:
editUrl:'#Url.Action("ActionName","ControllerName")'
Update2:
If your edit method is like below
public .. MyEditMethod()
{
//Add logic
}
then your editUrl will be
editUrl:'#Url.Action("MyEditMethod","WhatEverYourControllecNameIs")'
Related
Hello I have build application using codeigniter,
where i create one folder inside controllers like api.
it has few files like api/controller.php, api/user.php
i echo json from the all api controllers.
now i have to do some change with the json which is pass to api from one place.
it is not feasible to got to every controller and each function to so this change.
is there is any way like from any core file or anything where i can do code and it will be proceed before the api receive the output.
rg.
Get Attendee API :
current response : {success:true,attendeeList:{list of attendees}}
now i have to change every reponse like
{succss:true,data:{success:true,attendeeList:{list of attendees}} }
Hello I Have solved this by using $hook['display_override'];
enter image description here
I'm working on a new project and I'm using subfolders with my Views and Controllers because it's going to be a fairly big application. My problem is I can not load a View with an Id. I'm getting "Unable to load requested file" error.
This will load my view, but because I don't have the Id needed in the URL I'm getting errors because some of the functions I have require it:
$this->load->view('administration/header');
$this->load->view('administration/add_vendor_location');
$this->load->view('administration/footer');
But when I try and include the Id like so:
$this->load->view('administration/header');
$this->load->view('administration/add_vendor_location/Id');
$this->load->view('administration/footer');
I'm getting the "Unable to load the requested file" error. I know I can use re-direct, but this is coming from a Form Validation and setting all the POST data and errors in sessions is very time consuming / annoying.
Hope this makes sense!
Thanks!
In the code you provided, views/administration/add_vendor_location/Id.php must exist in order to load it.
If you're trying to pass a variable to the view, you would do so using an array in the secend parameter:
$this->load->view('administration/add_vendor_location', array(
'id' => $id
));
See the CI View documentation
I have a bit of an annoying problem in Zend Framework 2. My js, which is located in my public/js folder, calls an action in the controller for my admin module. This is the call:
$.post('admin/expand', {
id: CCID
},function(data){
if(data.hasOwnProperty('info')){
expand(data.info);
} else {
console.log('Can\'t find customer info.');
}
},'json');
The call works fine normally, but then sometimes it won't be able to find the action. The console will say:
POST http://localhost/admin/admin/expand 404 (Not Found)
So I'll change the path in the AJAX to just 'expand' instead of 'admin/expand' and it'll work for a while... and then it won't until I change it back!
So it seems that sometimes it gets confused about the routing and sometimes it doesn't. Is this a namespace problem? The js file is supposed to be in my root/public/js, right? Does anyone know what the problem is here?
Try changing the url from admin/expand to /admin/expand . It is more pragmatic to use ZF2 routes.
I have an app in Yii and i want to ajax form submition without inline script unlike this link said, because inline script is bad for SEO.
So i create php file and put my js+php code in it with header
Header("content-type: application/javascript");
And include it as Javascript file.
But java script return this error :
Fatal error: Class 'Yii' not found in
/var/www/mydomain/js/sendmessage.php on line 16
Which line 16 contains:
var sendurl = request->getUrl()
?>+"/handler";
What should i do to make it work ?
Your problem is that Yii is not yet initiated in your file.
You should probably make a JsController or something like that, and let it serve the js content for you instead of just making one external file like that. That will ensure that you have all the classes loaded that you want.
I mean, you wouldn't create a PHP file like that for anything else on your website right? So why do quickfixes just because it's js.
I am slightly confused as to what the best method is of handling redirecting and displaying error/ success messages using an MVC framework, specifically Kohana.
I have a Controller User which extends the Base controller.
Am am trying to use the action_remove() function in the base controller then redirect back to the page they were on and display a message 'User has been removed....'
I don't want to pass the error message in the GET params. Is there a standard way of doing this?
You should try to use flash session data. It is very useful when You want to show errors as well as messages. At first access flash data is removed so it can be accessed only once.
http://docs.kohanaphp.com/libraries/session#flash_session_data
Also there was some related post about this here Which is the best way to display 'flash messages' in kohana v3?
You can use Message Modules in kohana 3.x. its used to display messages.
please download this module it from here and extract . Then paste it in modules folder.
https://github.com/GoldCoastMedia/kohana-flash
Then enable it in applications/bootstrap.php like as follows.
'message' => MODPATH.'message',
There are 5 type of messages are available. success, error, warning, info, notice. You can give styles for each messages . but you need to write class in the same name of message type.
Message::error('pls login to access');
//to assign message type.its error message.
echo Message::display();
//to display it
thats it. but remember that you need to create class in the name of success, error, warning, info, notice to apply styles.
to check condition in view file , you can use it.
$sucessful_message=Message::display();
if($sucessful_message) { ?>
<div id="messagedisplay" class="padding_150">
<div class="notice_message">
<?php echo $sucessful_message; ?>
</div>
</div>
<?php } ?>