Welcome Guest, Not a member yet? Register   Sign In
Open popup by a form's submit button?
#1

[eluser]Unknown[/eluser]
Hi,

I am wondering if it's possible to open a popup through a form's submit button. As far as I can see, CI does not offer an option to do that. Or am I simply overseeing things?

I would like to display search results in the manner of
Code:
echo form_open('welcome/search');
but in a popup, so I would like <form action="..."> to be something like window.open("..."). Or do I -somehow- have to use
Code:
echo form_submit('mysubmit', 'Submit Post!');
with its third parameter for JS? But then I cannot get the form action disabled/empty when I call form_open('');

Can anyone help?

Thanks,
Lupida
#2

[eluser]obiron2[/eluser]
try setting the third parameter to call a JS function and the first thing the function will need to do is cancel the submit action then pass the data as an Ajax call to be returned to a lightbox type <DIV>.

Sorry it that is a bit vaugue, but a lot of it will depend on which ajax library you are using or whether you are going to hand roll your Ajax (which is by far the best way to learn)

Obiron
#3

[eluser]obiron2[/eluser]
try setting the third parameter to call a JS function and the first thing the function will need to do is cancel the submit action then pass the data as an Ajax call to be returned to a lightbox type <DIV>.

Sorry it that is a bit vaugue, but a lot of it will depend on which ajax library you are using or whether you are going to hand roll your Ajax (which is by far the best way to learn)

Obiron
#4

[eluser]Unknown[/eluser]
After a bit of seesaw changes and jQuery debauchery I decided to use the standard form action, let the POST data be processed by a controller function, which saves the results in the session's userdata and opens yet another controller function in a popup, which grabs the data from the session, phew!

Not too straightforward but works like a charm without me pondering about AJAX for the time being.

lupida




Theme © iAndrew 2016 - Forum software by © MyBB