Forum OpenACS Q&A: form output in a new window...

Collapse
Posted by David Kuczek on
On one of our pages that is basically one huge form, I would like to
let the user check on one value inside the form.

In our case it is whether a URL is already in the database or not. I
don't want to let the user fill out the entire form before he sees
this information via ad_return_complaint on OurHugeForm-2.tcl...

I would like to have a little window popping up when the user pushes
the  <input type=submit> button that should be located right under the
<input type=text name=url> field...

Any ideas. I didn't really get it working...

Collapse
Posted by Jonathan Ellis on
So you want a button the user clicks on that "tests" his url, before he clicks the submit button?  Give the "test" button (input type=button, not type=submit) onclick of something like

"window.open('url-check.tcl?url=' + escape(document.myform.url.value))"

Collapse
Posted by Trieu Truong on
Did you try using the "target" attribute in <form>?
Collapse
Posted by David Kuczek on
Hello Trieu,

I tried target in the beginning and it didn't really work. I might have made some mistakes though...

Jonathan: Works great! Exactly what I wanted...

For the record: You have to give your form a name and reference it inside the input tag:

1. <form method=POST action="wherever-2.tcl" name=myform>

2. <input type=button value=check onClick="window.open('check-url.tcl?url=' + escape (document.myform.url.value), 'pop', 'scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=0,resizable=yes,width=680,height=500')">

Thanks