


I have a form that I am going to be writing the data to a sql database. My form has 16 fields. One field will go to one column and the remaining 15 fields I want to submit as a single string to another column. I know that I am going need to write an update code but not sure how to do this. I know that the update script will need to be in the first line of my submit button. Does any one have a example of how to do this?
Views
Replies
Sign in to like this content
Total Likes
If you want to concatenate multiple text fields into a single text field, you can attach the following JavaScript to the submit button. The field delimiter may or may not be required for your solution. I would recommend validating each text field or parsing the concatenated value ('hiddenField' in this case) to remove any whitespace characters that could potentially irritate the SQL driver or table.
form1.page1.subform1.hiddenField.rawValue = form1.page1.subform1.f1.rawValue + " "
+ form1.page1.subform1.f2.rawValue + " "
+ form1.page1.subform1.f3.rawValue + " "
...
+ form1.page1.subform1.f15.rawValue;
Views
Replies
Total Likes
Ok. I have added the script below and its not doing anything. When I'm in
Acrobat and do a Ctrl+J it is telling me that the Submit button does not
have any properties. Here is what I have done to this point.
1. I have 3 text fields. I left them at the default name for now
(TextField1, TextField2, etc.)
2. I have added another text field but left it at visible just to make sure
that it is working properly. I have changed the name of that field to
AllFields.
3. I have added a submit button. I added a click event to the submit
button and enter the script that you provided.
What am I missing?
Thanks,
Brad
Views
Replies
Sign in to like this content
Total Likes
If you added script to the submit button then it is no longer a submit button. Just put a regular button on the form and put the script on the click of the regular button, then see if the AllFields gets populated. Then we can worry about the submit.
Paul
Views
Replies
Total Likes
The fields are still not getting populated and I'm still getting that same
error message. I have added a "Button" and in the click event gave the
script that was provided.
Views
Replies
Sign in to like this content
Total Likes
Post your form to LiveCycle8@gmail.com and I will have a look.
Paul
Views
Replies
Total Likes
Just want to make sure that you got it.
Thanks,
Brad
Views
Replies
Sign in to like this content
Total Likes
Just sent the fixed version back to you.
Paul
Views
Replies
Total Likes
Thank you..
Views
Replies
Sign in to like this content
Total Likes
Now that I have the information going to one field, How do I eliminate the "Null" fields from showing up? I'm sure its by validation of some sort but I'm not sure how to do that. I only want to see the fields that have information is them.
Thanks
Brad
Views
Replies
Sign in to like this content
Total Likes
Something I have done in the past is iterate over a subform, find all objects of type 'field', check whether they are null, and assigned a new value. This is example inititates the processing on a button click. I suspect you could add it to doc:Ready, also.
// form1.subform1.Button1::click - (JavaScript, client)
var oNodes = subform1.nodes;
for (var i=0; i < oNodes.length; i++) {
if (oNodes.item(i).className == "field") {
if (oNodes.item(i).rawValue == null) {
oNodes.item(i).rawValue = "not null";
}
}
}
The tricky part is, 'What do you put in the field?'. If you put "" I believe you will get a whitespace character. If you are submitting the form to a backend service, that service may not appreciate a whitespace character.
Steve
Views
Replies
Total Likes
I plan on submitting it to a sql database. Here is the reason that I don't
want the Nulls. I have subform1 with to radio buttons. I have the buttons
set so only one can be selected (within the subform) at a time. I want to
be able to tell by looking at a sql query which one was checked.
Brad
Views
Replies
Sign in to like this content
Total Likes
Are the radio buttons defined in an exclusion group? If they are, each radio button is defined with a unique value. It would be easier to resolve if you could post the form or a subset of the form.
Views
Replies
Total Likes
Here is the form.
Thanks,
Brad
Views
Replies
Sign in to like this content
Total Likes
I don't see the form.
Views
Replies
Total Likes
My plan is to take every field on this form and submit it to one column in sql. In order to do this I have created an "AllFields" field on the form for everything to update to. I will eventually hide the "AllFields" field.
Brad
Views
Replies
Sign in to like this content
Total Likes
Make a break after:
form1.page1.AllFields.rawValue = form1.page1.TextField2.rawValue + " " + form1.page1.TextField3.rawValue + " " + form1.page1.TextField4.rawValue + " " + form1.page1.TextField6.rawValue + " " + form1.page1.TextField7.rawValue + " " + form1.page1.TextField8.rawValue + " " + form1.page1.TextField9.rawValue + " ";
if (form1.page1.Subform1.RadioButtonList.Voluntary.rawValue != null) {form1.page1.AllFields.rawValue= form1.page1.AllFields.rawValue+ form1.page1.Subform1.RadioButtonList.Voluntary.rawValue + " ";}
if (form1.page1.Subform1.RadioButtonList.Involuntary.rawValue != null) {form1.page1.AllFields.rawValue= form1.page1.AllFields.rawValue+ form1.page1.Subform1.RadioButtonList.Involuntary.rawValue + " ";}
form1.page1.AllFields.rawValue = form1.page1.AllFields.rawValue + form1.page1.CheckBox1.rawValue + " " + form1.page1.CheckBox2.rawValue + " " + form1.page1.CheckBox3.rawValue + " " + form1.page1.CheckBox4.rawValue + " " + form1.page1.CheckBox5.rawValue + " " + form1.page1.CheckBox6.rawValue + " " + form1.page1.CheckBox7.rawValue + " " + form1.page1.CheckBox8.rawValue + " " + form1.page1.CheckBox9.rawValue + " " + form1.page1.CheckBox10.rawValue + " " + form1.page1.CheckBox11.rawValue + " " + form1.page1.CheckBox12.rawValue + " " + form1.page1.CheckBox13.rawValue + " " + form1.page1.CheckBox14.rawValue + " " + form1.page1.CheckBox15.rawValue + " " + form1.page1.CheckBox16.rawValue + " " + form1.page1.CheckBox17.rawValue + " " + form1.page1.CheckBox18.rawValue + " " + form1.page1.CheckBox19.rawValue + " " + form1.page1.CheckBox20.rawValue + " " + form1.page1.CheckBox21.rawValue + " ";
Should catch the one zero of the button. Though not the other ones.
Btw. you could use Date and Timefields... but then you most likly would have to either rename the fields or change this script slighly.
You could do similar things to the checkboxes as you did to the radiobuttons... so you see at first glance, what checkbox was checked instead of seeing a "0" and "1" string.
Probably this is easier for you since you made it and I don't completly know what you want to do with it... the outgiven string would confuse me...
Views
Replies
Sign in to like this content
Total Likes
For what is is worth...
I would change the default bindings for each of the checkboxes (from 1 and 0) to reflect their caption. For example for the Network checkbox I would set it to:
This will sort the null entries and mean that the contents of the field make sense.
Could you not bind each field to a database instead? Not my area, so I will drop out gracefully now!
N.
Views
Replies
Sign in to like this content
Total Likes
I could bind each field to the database but I need the info in one column.
The only way I could make sense of it is to update everything to a hidden
field and bind the hidden field to the database. What my hope is that once
the info is successfully in the database we can use a Helpdesk program and
see the Form information in the Description of the problem.
thanks
Views
Replies
Sign in to like this content
Total Likes
I have made several changes most of them suggested by others...I still can not get the data to submit. I keep getting the same error. I have other forms being submitted to my database. Does anyone see anything that I am over looking?
Thanks
Views
Replies
Sign in to like this content
Total Likes
Does anyone have suggestions?
Views
Replies
Sign in to like this content
Total Likes