Fill-in-the-blank Story Generator - forms

I'm interested in creating a fill-in-the-blank story generator for kids. I want to create a form where they can put in the names of characters and other things and have that data populate a pre made story. After they hit SUBMIT they would be taken to a follow up page with their input and the story in plain text. I'm pretty new to this but very eager to learn. What would be the best way to go about creating this form that generates stories?

It seems you would need two database tables - one for storing the original story templates and another one for storing the generated texts.
The challenging part with the template database is signifying the parts where there can be user input. One idea - place a special format code inside the text in the following manner:
Once upon a time, in a forest far away, lived ::00001::.
Assuming you are loading that template as it is in an element inside a form (I would avoid textfields for this purpose and just place the text).
After the text is loaded into the web page (javascript onload), replace your markers with input fields (I'd use jquery for that). You can use jquery to search an elements text/innerHtml and replace it with another html element. Here is an idea how to do that. The replacement of markers with inputs can be done in a javascript while loop, as long as there is "::" in the text of the element.
Then your ::00001:: could be replaced for example with:
< input type='text' id='input00001' name='input[00001]'/>
Then, when the user submits the form, you can get the values for each field and store them to a second database with the given ids. This way, you will be able to reload them later (same process, only instead of inputs, you would replace the codes with their corresponding values).
This way, in the second database table you only save the input values and not the whole text, to save up memory. Probably in the second table you would like to store the id of the field, the value, perhaps a template id (so that you know for which story template it corresponds) and a user id or at least a timestamp, in case you can have many generated stories for the same template.
Hope this helps!

Related

Create a dynamic table in a PDF Form programmatically

I need to generate a pdf based on a template form.
In that form there is a table that needs to be populated.
Since the table can have a unknown amount of rows, what I was thinking was drawing the table and then adding it to a space on the form.
As in, the form would have a acrofield to receive the table itself.
I already managed to create the table and put it inside a pdf, but I'm having issues puting that table into a acrofield.
As far as I can understand a form only appears to accept these: button, text, choice, or signature.
I'm using Apache pdfbox and easyTable to manipulate the form and create the table.
Is it possible what I want to do? If so, where can I find more information about this topic?
Edit: This answer seems to be what I want to do.

Open form to record seleced from double click on same record in datasheet form

I've got a pair of forms that are both based on the same data table. One is a single form with a better layout of all the onfo, the other is a datasheet. I want to be able to double click on the project number in the datasheet form to open the details single form to that same record.
I've done it on a simplified practice db, but when I try it in my current db it opens the second form, but to a new record entry. This form is one that was a template that someone else downloaded and modified for our purpose, so maybe there is something stored somewhere else that is interrupting the filtering.
I deleted a couple of macros that I thought might be interfering, made sure that the form properties are cycling all records and that on form load it isn't directed to a new record. I can't figure out where else there is something preventing the form from being filtered for the selected record. Here's the code I've used in the datasheet form:
Private Sub combined_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmTaskDetailsExisting", acNormal, , "SLRtaskID = " & Me.SLRtaskID
End Sub
Anyone have an idea what I'm missing here.
Have you considered doing this with a split Form? You will have the Detailed view per record and the dataseet.
If you really want two independent forms due to your needs, your code looks ok. But two things may be happening:
The value in Me.SLRtaskID is not correct. Put a breakpoint in the code and check it.
There is code in frmTaskDetailsExisting that moves it to a new record when it is opened, regardless to the filter.

APEX - Can a Tabular Form with its MRU functionality have filtering functionality like an Interactive Report?

What I really need is a Tabular form that allows me to update multiple rows at a time while being filterable like an Interactive report. Any chance this is even remotely possible?
I would also like to hijack the row checkboxes on a tabular form that appear when the 'delete' functionality is activated and use them to select which rows get assigned a to a group based on a common attribute. (i.e. My table contains parts in my inventory and I need to be able to assign parts with common attributes to a group for processing)
Perhaps a group-by function that creates a new row in a 'Group' table with the group as the PK and the parts assigned to that group as a list or something...?
Thoughts? I am kind of at a loss...
It's really not that hard :) You can easily transform an IR into a pseudo-tabular form. And even though there are always more stylish and elegant solutions, those usually involve lots of javascript and/or plugins. They're nice, but not always what you want or need of course.
So how to manipulate your output? Use the APEX_ITEM api!
Quick example. I have an ir built on emp. I added a checkbox and textbox.
select empno, ename, deptno,
apex_item.checkbox(1, empno) empno_selected,
apex_item.text(2, ename, 10, 10) ename_edit
from emp
Don't forget: in the column attributes, set Display text as to Standard Report Column. If you don't, the output will be in plain text. Since apex_item generates html code, you don't want the plain text of course :)
Now, to be able to perform DML based on the actions you do in those generated fields, you will need a process. Let me start off by pointing out though that the generated items are stored in application variables, namely in arrays in APEX_APPLICATION.
Take note of the behaviour of checkboxes: only ticked boxes will have their value stored in the array!
As an example, i've made this small On Submit process (also adding a SUBMIT button on the form to actually perform the submit...)
for i in 1..apex_application.g_f01.count
loop
insert into empselected(empno, selectiondate, ename_changed)
values(apex_application.g_f01(i), sysdate, apex_application.g_f02(i));
end loop;
This will loop over the records with the checkboxes ticked, and insert them into some table. For example, i ticked the box with KING and edited the textfield. See record nr 2 (1 is from a previous action ;))
It's not all the way there yet though. You still miss out on the functionality of a tabular form and it's processes, and things like optimistic locking. If you want to stay with tabular forms, you can also, for example, check out this link. There have also been some questions here about writing your own mru processes etc, like this one ;)
It is possisble, using the same tabular form.
Create an item (text item) in the tabular form region.
Create a submit button (Create a button displayed among this region's items)
Modify the where clause in the tabular form region source
For Example, you need search by customer name:
WHERE lower(CUSTOMER_NAME) LIKE '%'||lower(nvl(:PXX_SEARCH,CUSOTOMER_NAME))||'%'
If you need to search for other field only add other condition to the where clause
WHERE (
lower(CUSTOMER_NAME) LIKE '%'||lower(nvl(:PXX_SEARCH,CUSOTOMER_NAME))||'%'
or lower(CUSTOMER_address) LIKE '%'||lower(nvl(:PXX_SEARCH,CUSOTOMER_NAME))||'%'
)
Simple and use the same tabular form.

Symfony 1.4 Form Creater

Need: Ability to dynamically build Forms
Structure (simple idea not actual structure)
Admin: Form Assignment, where you create what field you want your new Form to have
FrontEnd: Where the New form will be implemented (this is the root of this question)
FronEnd Storage: When the New form is filled out the data points are written to a set of tables
The idea is simple enough, Go into Admin, select the fields, fieldType, and Labels you want
I.E.
Field Name:*Enter a specific field name, like f_name or email
FieldType: [Text, TextArea, Password, Radio, DatePicker, CheckBox, Select, etc]
Label: What to display on the resulting form, f_name = First Name, etc
Then I hit a page on the FrontEnd where the New form is generated, I fill it out and voila the data is stored in the FrontEnd Storage tables.
So the question is, idea's on how to accomplish this, I already have the Admin section done, it's dynamically building and appropriately binding a frontEnd From that I would like advice on.
Currently my idea is to simply make a shell form that is a huge ugly switch statement that builds sfForm elements and appropriate validators for each field (fields given from what was entered in the Admin area)
I feel this is the 'wrong' way to do it, I did find a plugin 'spyFormBuilderInterface2Plugin' which is old and build for propel not doctrine, but this is the basic idea of what I am after. So how would YOU do it?
Please note I am not looking to Dynamically ADD forms to a current form, I can already do this and it's exactly what is implemented in my Admin section, I need to take data a create a whole NEW form programatically
I've created something like you described, just the way you said.
I have a model FormDefinition which defines a form, and has a collection of FormFields. Each form field has a widget_class, widget_options, validator_class and validator_options.
I have a custom myForm which needs a FormDefinition in it's constructor. In the setup() of myForm, I loop through all fields a instantiate the widgets and validators.
Beacuse in our solution, we needed/wanted to store all form data in separate tabels. My myForm extends from sfDoctrineForm, and my backend has some logic which creates/updates the (php) model and database definition, by just calling the appropriate Doctrine methods. But you could also create an EAV store.

get text data from end user, with one field having uneditable list of drop down values(others input by end user)

I have a requirement, where some 14-15 fields of data have to be asked from the end user and some processing has to be done for those values.
But one of the values should be pre-filled with a drop down list of values, and user can only select one of the values in that list. Also, the user can add a suffix value to this fixed value(by fixed value i mean value in drop down list selected by end user). So this parameter when sent to the server for processing, is fixed value+suffix.
I want to know if this type of form processing can be done using bean/jsp. Or with any other method.
If you could give me a code sample for implementing this (whether bean or other method) then that would be great.
The processing that has to be done after the user submits all 14-15 values is written as java code. I should be able to invoke this code to do processing.
Of course it can be done using servlets/JSP.
You need to generate apage containing an HTML form. This form will have to contain a select element withh all the fixed options, and a text input where the user has to enter the suffix. When submitted, the servlet/JSP will have to get the submitted values from the request parameters, and do its processing.
A code sample would be too hard to give you. You need to read a whole tutorial about HTML forms, the servlet API and how JSPs work.