Joomla component keep form view on submit - php

I've been basically following the joomla guide for a front end form, but I'm having trouble understanding how to keep my form view once submitted. I'm getting data back, but it's from my controller and just replaces the form. This isn't a DB update, it's pulling data from an API that should be shown below the form... but I don't see how to do that based on the guide.
Sorry, I feel like this is a dumb question, I'm just not used to MVC yet. Maybe someone can point out a better guide for this?

Nevermind, I figured out a way around it. I'm using JQuery to get the results in a div.

Related

How does a user submit an article on a website?

I am working on this travel blog Trippindian.com . I want to build a page where a user can login via facebook and then write an article and submit it to us. Its just like I am posting a question on stackoverflow.
just FYI I am a noobie coder.
I want to understand the logic and functionality behind this.
Thanks
First, you need a database where you can store all these posts.
And then, you would need to create a page with a form element (HTML).
You would also need a php code that connects to the database and adds the value or values contained in the form.
That's pretty much what you need.
You could find other solutions, but I think it's the simplest one.

Pass GET to other view Joomla

I'm developing a component (backend). I got a listview with a $_GET that contains a ID number
and i want to send the $_GET to the add view
(JToolBarHelper::addNew('item.add', 'JTOOLBAR_NEW');)
But i don't find any good solution on this, i have inserted the value in listviews form, but i am not possible to take it out. I tried to create a add function in the controller for my add/edit view but is dosen't work. Hope someone can help me out.
You might consider JApplication/JSession like this

form review after submit with symfony

With symfony, I use widgets to display a form.
Once everything is filled and validated, I land on a "review" page where all the information the user entered appears as text (<span>). To do this, I created a formatter (instead of table, I called it "review"). The formatter spits out <span> instead of <input>
It works great for basic inputs, but when it comes to Choices, or Dates, it's not working super great... I feel there is another way to have a review page without having to write a whole page just for this?
Any ideas?
Unfortunately, I find it sad that there is no concept of displaying the data already posted on a page with Symfony.
Using getValues() to recreate the whole UI with the same exact design with the exception of using <span> instead of <input> doesn't keep the code DRY at all...
I decided to create a formatter as I mentioned in my question with adding some "if" clause to make sure everything displays correctly.
You could adjust your formatter to handle other types of form elements, or you could try using some type of lightbox before the form is submitted. But in the end, I'd just go ahead and write that extra page. Everything your trying to do sounds so much more complicated than just a separate page.
I find this approach such a hassle. Why don't you pass the result of $form->getValues() to the view and output them however you want in the template?

zend get posted variables from static form from the view file

Ok so i tried using zend form but what i'm trying to accomplish is way too much for me to handle zend form. I'll try to describe it in a few lines maybe you have a solution for me if not you will understand why i chose to use a form in a view file.
I have a form for searching products in a database. THe search is done using autocomplete (custom made). When the user presses "Add product to list" the product is being added to a div in the form, creating the impression of a list. I want to submit this (the newly added inputs in the form) to the controller and process the form. I don't know how to do this, or it is not possible, have no clue yet but the zend form gave me so many headaches that i am very close to stop using it.
So i have designed a static form, in my view file. I have my jquery stuff there, i add data (hidden input fields and checkboxes) and i want to post to my controller. The question is how do i get the $_POST array in my controller?
I'll try to answer you as better as I can givin how your question is vague.
If you have a html form on your webpage all you need to do is set its action to your controller:
action="mycontroller/myaction"
And in case its not:
method="post"
And in your controller in fact this would work:
$_POST['param_name']
but the Zend way would be in your controller's action:
if ($this->_request->isPost()) {
$data = $this->_request->getPost();
Zend_Debug::dump($data);
}
Hope this help. If you need more details edit your question to make ti more clear.
Also it does'nt matter if the form was created with Zend_Form or by hand that code will work regardless.

how can i get data from other browser without refreshing browser in cakephp?

i am new to cakephp, and also new to ajax.
the function i trying to do is basically like this:
i am in a add page, which let me select few customer on that page.
but i wanted to set 1 more link for user, which let user click customer immediately on the add page, and the new data will show in my add page without refresh, so that the user can choose the new added customer for enter my form.
i know the idea is base on using ajax. but i am still new to it and hope any 1 can give some comment or suggestion how can i start??
the problem i face is, i am on a form, when i adding a new customer in the form, i wanted to get the new customer to show in my form without refresh. what can i do for getting this function?
thanks a lot and i will very appreciate your answer.
CakePHP has an ajax helper, which requires the prototype library. You can find the API for the AJAX helper here:
http://api.cakephp.org/class/ajax-helper
And a guide to using the helper here:
http://book.cakephp.org/view/208/AJAX
And a list of cakephp/ajax articles here:
http://bakery.cakephp.org/articles/search/tags/ajax
It's beyond the scope of a Stack Overflow answer to give you a tutorial but hopefully these links will help.
easiest way is to use a javascript library (like jquery for instance) to do an ajax request.
probably to a controller/action in your cake framework.
the easiest way would probably be returning the data in JSON and filling out your form fields.
PHP Json
jQuery AjAX/JSON

Categories