Hi there
I have a very simple form (called ALLOTMENT_APPLICATION_FORM), consisting of three fields, that I wish users to input data from to populate a database table.
The form has one page (called YOUR_CONTACT_DETAILS)
The fields on the form are:
TITLE (static list, drop down)
FIRST_NAME (text field)
LAST_NAME (text field)
I have created the database resource and associated a business view to the form.
The form is one page and there is a Submit button at the end. The form has a script event attached to it (called INSERT_APPLICANT). This is a javascript and is:
//begin script
importPackage(com.ebasetech.xi.api);
importPackage(com.ebasetech.xi.services);
var newTitle = fields.TITLE.value;
var newFirstName = fields.FIRST_NAME.value;
var newLastName = fields.LAST_NAME.value;
resources.ALLOTMENT_APPLICATION_FORM.value = newTitle;
resources.ALLOTMENT_APPLICATION_FORM.value = newFirstName;
resources.ALLOTMENT_APPLICATION_FORM.value = newLastName;
tables.ALLOTMENT_APPLICATION_FORM.insertRow();
//end script
When I test the script, the following error is returned when the submit button is clicked:
org.mozilla.javascript.EcmaError: TypeError: Cannot set property "value" of undefined to "Ms." (INSERT_APPLICANT#10)
I am using version 4.4.2 with a MySQL database. I am pretty sure th problem is in the JavaScript, any thoughts what that may be problem
Many thanks
James
using javascript insertRow() function
Moderators: Jon, Steve, Ian, Dave
-
james_petersen
- Ebase User
- Posts: 4
- Joined: Mon Dec 03, 2012 8:47 pm
- Wai
- Moderator

- Posts: 165
- Joined: Wed Sep 12, 2007 9:04 am
- Location: Sandy, UK
- Contact:
Hi James,
Will the form allow the user to submit more than 1 record?
If not, there is no need to use an Ebase table, therefore, you would NOT use the command:
tables.ALLOTMENT_APPLICATION_FORM.insertRow();
You only need to do this, when processing more than 1 record.
Instead, all you need to do is make sure that your 3 fields TITLE, FIRST_NAME, LAST_NAME are mapped to your database resource.
Then in your script:
resources.ALLOTMENT_APPLICATION_FORM.insert();
You do not need to declare additional javascript variables. Please let me know if that helps.
Will the form allow the user to submit more than 1 record?
If not, there is no need to use an Ebase table, therefore, you would NOT use the command:
tables.ALLOTMENT_APPLICATION_FORM.insertRow();
You only need to do this, when processing more than 1 record.
Instead, all you need to do is make sure that your 3 fields TITLE, FIRST_NAME, LAST_NAME are mapped to your database resource.
Then in your script:
resources.ALLOTMENT_APPLICATION_FORM.insert();
You do not need to declare additional javascript variables. Please let me know if that helps.
0 x
-
james_petersen
- Ebase User
- Posts: 4
- Joined: Mon Dec 03, 2012 8:47 pm
All sorted now
Hi Wai
Thanks for the reply. This has sorted the issue. The form is now submitting input to the database.
Thanks for the tip about mapping the resources I went and checked that and that would have been an issue if you didn't mention that
Cheers
James
Thanks for the reply. This has sorted the issue. The form is now submitting input to the database.
Thanks for the tip about mapping the resources I went and checked that and that would have been an issue if you didn't mention that
Cheers
James
0 x
Who is online
Users browsing this forum: Bing [Bot] and 40 guests