- This topic has 7 replies, 4 voices, and was last updated 12 years, 4 months ago by support-octavio.
-
AuthorPosts
-
Albatros78ParticipantHi,
I used the login / password template from mb1
When the form action link will work properly (issue in another post), I would like install a check function in JS to validate if the two input fields are not blank. If one of them is blank an alert message is displayed.
I have this js funtion ready (from a normal web site), but where install it and how ?
Need I to modify the html source file genereted from mb1 and add my JS reference on the top of html file and add my .js file as an external js file into the application ?
Regards
Albatros78ParticipantHello,
Does anyone has an answer ?
wayneModeratorIf your design is marked as a Form (see Properties Editor) then when you generate HTML code, a companion javascript file will be created with the naming convention <yourdesignname>_custom.js. You can safely add any javascript functions or modify current form functions in this file. This file includes a function named with the pattern preSubmit<formName>(theForm). You should add all validation or preprocessing to this function.
Wayne
Genuitec Mobile Team
Albatros78ParticipantOk..
Does this explanation works even if the form submit does not works today.I can uderstand in this case that I can put for example a ‘ok’ button in the form, and add a JS script which is inside the link button where is refererred into the designname_custom.js file
Or does I need to write my js function just into the presubmit function with not anything more ! Does this function is automatically called by the form at loading and leaving ?
Does it right ?
wayneModeratorThe preSubmit<Form>() and postSubmit<Form>() generated functions in the <design>_custom.js file are named for the points in the form processing workflow that they are call. So if you need to preform form validation customize the preSubmit function. Below are examples of the 2 functions stubbed out and ready for customization.
function preSubmitTest_form(form) { // add custom presubmission code here, e.g., form validation & error handling // return false to terminate form submission return true; } function postSubmitTest_form(success, data) { // add custom postubmission processing code here, // e.g., parse and process results & update UI controls with data as needed // return false to terminate form processing var result = true; if (success) { // process data result = true; } else { // submit failed // data = error msg result = false; } return result; }
Wayne
Genuitec Mobile Team
Albatros78ParticipantHi Wayne,
With mb1 Beta 2, I try to use the form action.
My sample is:
First page is home.mobi and second page is menu.mobi.
In properties the first page is declared as:
form= yes
form method=post
form URL = menu.mobi
form result = web pageI have just one button which is declared as form action= submit.
When I run that and I click on my button, nothing appears and the second page is not displayed !
something is wrong from my side to run the form method correctly ?
HalusafedMemberThanks Wayne,
but I am new to java and need a little help with the “custom presubmission code”
-What is it and what might be an example?
support-octavioMemberHi Halusafed,
We are working on a form guide. Probably will be available late next week.
-
AuthorPosts