Form In modal

20 views
Skip to first unread message

Emerson Luiz

unread,
Mar 1, 2015, 6:30:44 PM3/1/15
to django...@googlegroups.com
Hi,

I have the following problem:

I need to set up a form, that when the OK button is clicked, it passes a parameter and open a modal with the result.
Today the query works as follows:


The 3188888888 is the parameter.

return:

Operadora  Tipo
CLAROMOVEL



Thanks

luis zarate

unread,
Mar 4, 2015, 2:15:32 PM3/4/15
to django...@googlegroups.com
Fast solution: 
In Javascritp you can do this:

    element = document.getElementById("myinput");
    window.open("http://127.0.0.1:8000/consulta/?consulta="+element.value, "MsgWindow", "width=200, height=100");


but continue reading


Are you use ajax? 
If the answer is not, then see https://github.com/yceruto/django-ajax.

A concept problem is there, modal is a interface view (in the browser) and your method refresh the page (It is a GET Request).

I don't know what kind of framework you are using, but in general you can do something like this:


<div id="mymodal" class="modal">
Operadora      Tipo
CLARO    MOVEL
</div>

<script>
$("#mymodal").modal();
</script>



for more information see
http://getbootstrap.com/javascript/#modals
http://jqueryui.com/dialog/

PD: You can do better implementation if you are using django ajax



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9f8e5cbb-45a0-464d-9047-6ccfdc0a4757%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
"La utopía sirve para caminar" Fernando Birri
Reply all
Reply to author
Forward
0 new messages