possible to post FORM contents to FloatBox?

Page: 1

Author Post
Member
Registered: Apr 2009
Posts: 81
Any way to make a form submit values to a page which opens in Floatbox?

<form action="somepage.asp" method="post">
<input type="text" name="cost" size="4">
</form>

I would like somepage.asp to open in a Floatbox window if possible. I only need to pass the value of one text field. If the above is not possible, maybe some Javascript will somehow allow a regular <A> link instead of the actual form?
Administrator
Registered: Aug 2008
Posts: 3382
To have a form submission result in a floatbox being launched, you need to have your action page return the necessary page markup to autoStart your floatbox content.
One clean way to do this is to have your action page (somepage.asp) place the content to be floatboxed in a hidden div on the returned page and include an autoStart anchor associated with that hidden div.

Something like this:
<a href="#hiddenDiv" class="floatbox" rev="autoStart:true"></a>
<div id="hiddenDiv" style="display:none;">
Hey! You entered cost = "free"!
</div>


The second approach you alluded to - using javascript - can also work. Instead of having a submit button, you would have a normal button with an onclick action. The onclick javascript would need to fetch your input field's value and pass this value to your server side code through a querystring. You would use floatbox's fb.start() function to fetch and show the content. Let's say you've got your form field value in a javascript var called 'theCost'. That fb.start call would look something like:
fb.start({ href: 'somePage.asp?cost=' + theCost, rev: 'someFbOption:someFbOptionValue etc.' });


See the API reference for details on the fb.start function.

Page: 1