|
PassingFormValues
Explanation on passing form variables values to MB pages
IntroductionFor example we have the following form on one MB page: <form action="yoururl.php" method="get" id="myform" onsubmit="return false">
</form> and then in youurl.php we're doing the following: <?php $name = $GET'name'; $email = $GET'email';?> <?php echo $name ?>, your message sent!to show the sender name. That's all! DetailsSee the working example here: http://okonet.ru/projects/modalbox/ Please note: http://prototypejs.org/api/form/serialize |
Sign in to add a comment
Verry cool, but have to read a lot to get it i quess;) iI think it's wurth that!
Is there a way to change the method from GET to POST? I tried:
Doesn't work...
Is there a way to change the method from GET to POST? I tried:
Doesn't work...
Is there a way to change the method from GET to POST? I tried:
Doesn't work...
I think the order of the "show(" argument's are given regarding the previous release. The url of the next modalbox should be the the first one.
try
method: 'post'
any idea how to post multipart MIME? our form has a field for uploading a picture but the MB requests are url-encoded. Any help would be great.
TIA, -gt
It doesn't work to me. Is there any update that breaks it? I get to yoururl.php but i can't get the params. It also tried with : $('myform').serialize(true) instead of : Form.serialize('myform') I just can't make it work!!! Any help there? regards, juanfra
the way to call it is Modalbox.show('yoururl.php', {params: Form.serialize('myform') }); return false;
Not Working
It's working on the demo page here: http://wildbit.com/labs/modalbox/
Corrected Text
and then in yoururl.php we're doing the following: <?php $name = $_GET['name']; $email = $_GET['email']; ?> <h1><?php echo $name ?>, your message sent!</h1>Could use www.gettopost.com/gettopost.html to do the GET to POST conversion?
I can get $POST's to work for <input type="text"> but CAN'T for <input type="file"> Is there a way to do this? Is there a param spot for enctype="multipart/form-data"? TIA
I was having this problem with a form. What fixed things for me was to add an "id" tag to the form declaration.
(sorry for my english, but i speak spanish) in this example the form is put into a modalbox o a normal window????
i trie tu put a form into modalbox to send data to the same modalbox (or another)... this example works for send data to the normal window to modalbox, but i can't send data to the form on modalbox to modalbox... how can i get it??
$GET works, but is there a way to automatically close the the box after success? (I'm guessing maybe DOM?)
Hello, i need to send my data via $POST, what i need to change and where?
thanks a lot
and what about instead of the action being a 'yoururl.php' it is a <?php echo $somevariable ?>, how would you make the messages contained within that variable appear in the next modalbox?
I am opening a LOGIN textbox and password field in the modal window(Actually my PHP page). After submitting of the data using POST, i want to display WELCOME page in same modal window...
Is it possible.. ?
For the POST version it works I do that : <form id="formulaire" action="url.php" method="post" onsubmit="return false;"> ... <input type="submit" title="TITRE" value="Show" onclick="Modalbox.show('url.php', {title: this.title, method: 'post', params:Form.serialize('formulaire'), overlayClose: true }); return false;" class="formulaire" /> </form>
It works fine :)
Yeah this script from paul with POST worked for me too!!! Thx really much paul!!!
i got problem too with <input type="file"> Is there a way to do this? Is there a param spot for enctype="multipart/form-data"?
to answer a few of your questions re file uploads:
This cannot be done because modalbox uses Prototype's Ajax.Request function which does not allow uploads.
There is another solution though: look into SwfUpload? - http://swfupload.org/
I am struggling with the wizard function. I have a form in the modalbox. When I click the button, I want to pass the variables of the form to itself and then repaint the modalbox with the changes. I am running PHP on the back side. It seems like this should be possible, but when calling ...
<button type="button" onclick="Modalbox.show('Making changes', 'sameAsOriginalPage.php', {width: 600, height:650}); return false;"><< Remove selected users from group</button>
The box shrinks and just stays there. What am I doing wrong?
Mike
dynamic content/form elements is not included when submitting the form using modalbox
I am trying to submit a contact form. I have tried a number of things, but I am not able to get the form to submit (email). It will either submit the form, or continue to the yoururl.php, but I cannot get it to do both submit and move to the yoururl.php page.
Any help would be great.
Here is the code I am using for the form:
<form id="form" name="form" method="post" action="forms/process.php"> <label>Name <span class="small">Add your name</span> </label> <input type="text" name="Name" id="name" />
<label>Email <span class="small">Add a valid address</span> </label> <input type="text" name="Email" id="email" />
<label>Phone <span class="small">Min. size 10 chars</span> </label> <input type="text" name="Phone" id="phone" />
<label>Message <span class="small">Leave a message</span> </label> <textarea name="Message" class="mytextarea" id="message"></textarea>
<button type="button" value="Submit" onclick="Modalbox.show('forms/yoururl.php', {title: 'Sending status', params: Form.serialize('myform') }); return false;" />Submit</button>
good stuff. thanks!
I had a prolbem using it, so I tired this :
Modalbox.show(this.href, {title: this.title, width: 600, method: 'post', params: inscriptionCB.serialize(), overlayClose: true }); return false;
Note that I used inscriptionCB.serialize() instead of Form.serialize('inscriptionCB') (inscriptionCB is the name of my form).
Hoping it will help somebody.
Oh sorry, this tricks works onl with Firefox. Finally I used : Modalbox.show('inscriptionCB_commentaire.php',{title: 'Commentaire envoyé', width:600, method: 'post', params: Form.serialize(inscriptionCB_ajoutCommentaire), overlayClose: true})
Note the "Form.serialize(inscriptionCB_ajoutCommentaire)"
thaks alot
hi, i have a select field in my modal box. but it is a form that should be filled and updates the database. Any idea on how to do this. the select is not being fetched
Value of FCKeditor don't work! :/
Yep the POST Method works ...
<input type="submit" value="Visualizar o relatório"
Tks a lot!