Open a popup window with bonita form fields
Hello!
I would like to know ( If this is possible in Bonita SP ) how to implement a form that have two link buttons:
- Link A: Opens a popup window and show some formatting (htrml/css) fields from the instance process to be printed.
- Link B: Submit the form(next step)
Any ideas will be welcomed.
Thanks in advance,
Fabiana
3 answers
Hello,
You can follow those steps :
- Create a form,
- on the submit button set "submitPrint" in the class input field in Appearance tab> Field> Custom style
- in this form put a new html widget after the submit button
- Click on data tab
- put in initial value this javascript code
<script type="text/javascript">document.getElementsByClassName("submitPrint")[0].onclick=function(){<br />
/*<br />
* this example prints the whole window by click on submit button,<br />
* you can format data as you want by adding style, text then print.<br />
* You can do it by many ways, you can also retrieve data from fields
/*<br />
* this example prints the whole window by click on submit button,<br />
* you can format data as you want by adding style, text then print.<br />
* You can do it by many ways, you can also retrieve data from fields
* then print its in a new popup opened through javascript<br />
*<br />
*/<br />
window.print(); // this will print the whole window
*<br />
*/<br />
window.print(); // this will print the whole window
var retrieved_values = "fdsf";//get your fields value<br />
<br />
var myWindow = window.open("","MsgWindow","width=200,height=100");//open a new popup<br />
myWindow.document.write("<p>"+retrieved_values+"</p>");//print your popup<br />
};
<br />
var myWindow = window.open("","MsgWindow","width=200,height=100");//open a new popup<br />
myWindow.document.write("<p>"+retrieved_values+"</p>");//print your popup<br />
};
</script>
Hello!
Ttoine: I can use "submit" buttons! I tried with the following widget:
- Widget > Submit
- Appearence - Cell > Button style option: Label
- General - Options > HTML Attributes:
- But I don't know how to open the "window.print()" result in a new window or maybe, if exists, maybe I can use some code to send the form to the printer without opens a window and after goes to the next step.
Nicolas: please, can you send me some code example, or something like that? Or as I explained above, can be just some code to send the form directly to the spool service to print the data and go to the next step!
Thank you for your kindness!
Fabiana
you can add a javascript event listener on the link that displays an hidden fieldset which contains your data. Then you can apply some css rules to render as a popup.
Comments
Hello, do you need to use links for that, or you can use submit buttons ?