|
|
(44 intermediate revisions by 3 users not shown) |
Line 7: |
Line 7: |
| Scrolling forms are allowed, with a couple of notes. Footerbars won't work (since the bottom needs to scroll up), nor will scrolling controls (which confuse the scroller). | | Scrolling forms are allowed, with a couple of notes. Footerbars won't work (since the bottom needs to scroll up), nor will scrolling controls (which confuse the scroller). |
|
| |
|
| The information on a form can be submitted to a URL by calling the form.submit() function. The values for all controls on the form which have their Name property defined will be appended to the URL as an HTML query string. | | The information on a form can be submitted to a URL by using the [[Ajax]] function. |
|
| |
|
| == Properties == | | == Properties == |
Line 15: |
Line 15: |
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
| | background || Will override the background with a pattern or an image. <pre>-webkit-gradient(linear, left top, left bottom, from(#55aaee), to(#003366));</pre> | | | attributes || The names of HTML attributes which apply to this form, separated by spaces. Design Time. |
| or
| |
| <pre>
| |
| url(http://www.nsbasic.com/images/eiffel.gif);</pre>
| |
| At runtime, you need to force a redraw:
| |
| <pre>
| |
| Form1.style.background="red"
| |
| Form1.style.width="100%"
| |
| </pre>
| |
| To prevent the image from repeating to fill the full window, do this:
| |
| <pre>
| |
| Page_jqm.style.backgroundRepeat = "no-repeat"
| |
| </pre>
| |
| If you are using jQuery Mobile, the best way to control the background color is to use themes. It will work better on PhoneGap Build.
| |
| |- | | |- |
| | fullscreen || True/False. If True, the form will automatically fill the entire device screen. The IDE will still use height and width at design time. | | | backgroundColor || Sets the form's background color. Can be a color name, #RRGGBB, rgb(R,G,B), or transparent. |
| |- | | |- |
| | height || The height of the form in pixels. Default is 460. | | | backgroundImage || Sets the form's background pattern or image. Overrides the backgroundColor property. Works best if image is in the project folder. Do not use absolute paths. To stop image from repeating to fill the screen, put <code>background-repeat:no-repeat;</code> into the form's style property. Gradients like <code>linear-gradient(#55aaee,#003366)</code> can be set at design time or runtime. URLs like <code>url(https://www.nsbasic.com/images/eiffel.gif)</code> can be set at runtime only. |
| | |- |
| | | centerScreen || If True, the form will be centered on the screen at runtime. Good for different screen sizes. Scrolling must be false. Design Time. |
| | |- |
| | | class || The names of CSS classes which apply to this form separated by spaces. Design Time. |
| | |- |
| | | designHeight || Used to calculate height if expressed as a percentage. If 0, then same as height in pixels. Design time only. |
| | |- |
| | | designWidth || Used to calculate width if expressed as a percentage. If 0, then same as width in pixels. Design time only. |
| | |- |
| | | fullscreen || True/False. If True, the form will automatically fill the entire device screen. The IDE will still use height and width at design time. Design time only. |
| | |- |
| | | height || The height of the form in pixels or a percent of designHeight. |
| |- | | |- |
| | left || The left position of the form. Use this for forms that are not full screen. | | | left || The left position of the form. Use this for forms that are not full screen. |
Line 38: |
Line 37: |
| | locked || If set to true, the controls on the Design Screen cannot be moved | | | locked || If set to true, the controls on the Design Screen cannot be moved |
| |- | | |- |
| | language || The programming language used in the code for the form. Can be BASIC or JavaScript. | | | [[Modal Forms|modal]] || If set to true, the form will be displayed centered on top of any other forms. Other forms will be grayed out and cannot be accessed until the form is hidden. Design time only. |
| | |- |
| | | language || The programming language used in the code for the form. Can be BASIC or JavaScript. Design time only. |
| |- | | |- |
| | method || Get or Post. The method that the http form is sent by. | | | openMode || Should the form be open at startup? Use this for forms which are to remain open. There is no need to set this for the first form of the project: that is set in [[Properties Window|Project Properties]]. Design time only. |
| |- | | |- |
| | openMode || Should the form be open at startup? Use this for forms which are to remain open. There is no need to set this for the first form of the project: that is set in [[Properties Window|Project Properties]]. | | | parentForm || The name of the parent form. If blank, the main page (NSBPage) is used. Can be used to make a form a child of another control or form. |
| |- | | |- |
| | script || Opens the Code Window for the form. | | | position || Determines how a form is positioned. Normally set to 'absolute': the form is positioned according to the left and top properties. If set to 'relative', [[Responsive Design Made Simple|Responsive Design]] principles apply. |
| |- | | |- |
| | scroll_options || iScroll options. See iScroll docs at http://iscrolljs.com. | | | script || Opens the [[Code Window]] for the form. |
| |- | | |- |
| | scrolling || Allow scrolling? | | | [[screenMode]] || How will the form be displayed? |
| | <br>''Full'' - Screen using full width and height. |
| | <br>''Actual'' - Size of width, height, left and top. Use for Modal forms. |
| | <br>''Center'' - in screen, using width and height. |
| | <br>''Zoom'' - width and height to screen size and center horizontally. Max of 2. |
| | <br>''noStyle'' - no automatic styling, Just use actual class and style properties. |
| |- | | |- |
| | script || Opens the Code Window for the form. | | | scroll_options || iScroll options. See [https://github.com/cubiq/iscroll iScroll] docs at https://github.com/cubiq/iscroll. |
| |- | | |- |
| | style || The CSS style for the form. | | | scrolling || Allow scrolling? Design time only. |
| |- | | |- |
| | setFocusID || The control to get the focus when the form is shown. | | | setFocusID || The control to get the focus when the form is shown. |
| |- | | |- |
| | Url || The URL to be called when the form is submitted using the submit() function. | | | style || The CSS style for the form. |
| |- | | |- |
| | width || The width of the form in pixels. Default is 320. Percents can be set at runtime. | | | width || The width of the form in pixels or percent of designWidtth. Percents can be set at runtime. |
| |- | | |- |
| | reset() || Clear all fields on the form. Runtime only. | | | reset() || Clear all fields on the form. Runtime only. |
| |- | | |- |
| | submit() || Submit the data on the form to the specified URL. Runtime only. See [[Location]] as well. | | ! Xpert |
| | |- |
| | | HTML || HTML to display on the form. This HTML is displayed on the form before any controls are rendered. It can be used instead of the Drag and Drop method of the Design Screen. |
| | |- |
| | | script || Opens the Code Window for the form. |
| |} | | |} |
|
| |
|
Line 80: |
Line 90: |
| |} | | |} |
|
| |
|
| == Example (Basic) == | | == Example == |
| | |
| | <tabber> |
| | JavaScript= |
| | <syntaxhighlight lang="JavaScript"> |
| | Form1.style.backgroundColor="red"; |
| | Form1.style.width="100%"; |
| | |
| | // To prevent the image from repeating to fill the full window: |
| | NSBPage.style.backgroundRepeat = "no-repeat"; |
|
| |
|
| <pre>
| | // Set gradient background at runtime: |
| Function btnSendData_onclick()
| | Form1.style.backgroundImage="linear-gradient(#55aaee, #003366)"; |
| Form1.submit()
| |
| End Function
| |
| </pre>
| |
|
| |
|
| To prevent a form from being submitted when the return key is entered in a field:
| | // Change the theme of a Form at runtime. Needs to be done each time you show a Form: |
| <pre> | | $("#NSBPage").page({theme: "a"}) // jQuery Mobile |
| Function Form1_onsubmit(e)
| | </syntaxhighlight> |
| e.cancelBubble=True
| | |-| |
| e.returnValue=False
| | BASIC= |
| End Function
| | <syntaxhighlight lang="vb.net"> |
| </pre>
| | 'Change color at runtime |
| | Form1.style.backgroundColor="red" |
| | Form1.style.width="100%" |
|
| |
|
| == Example (JavaScript) == | | 'To prevent the image from repeating to fill the full window: |
| | NSBPage.style.backgroundRepeat = "no-repeat" |
|
| |
|
| <pre>
| | 'Set gradient background at runtime: |
| btnSendData.onclick = function() {
| | Form1.style.backgroundImage="linear-gradient(#55aaee, #003366)" |
| Form1.submit();
| |
| }
| |
| </pre>
| |
|
| |
|
| To prevent a form from being submitted when the return key is entered in a field:
| | 'Change the theme of a Form at runtime. Needs to be done each time you show a Form: |
| <pre>
| | $("#NSBPage").page({theme: "a"}) ' jQuery Mobile |
| Form1.onsubmit = function() {
| | </syntaxhighlight> |
| window.event.cancelBubble=true;
| | </tabber> |
| window.event.returnValue=false;
| |
| }
| |
| </pre> | |
|
| |
|
| To change the background image on a form:
| |
| <pre>
| |
| Form1.style.backgroundImage="url(https://www.nsbasic.com/images/lavalamp.gif)"
| |
| </pre>
| |
| == Output == | | == Output == |
|
| |
|
| <pre>
| | [[File:Gradient.png]] |
| (Url is called with values in the query string)
| |
| </pre>
| |
|
| |
|
| == Related Items == | | == Related Items == |
Description
Forms act as containers for controls. To go to a new form, use the ChangeForm() function.
To add a Form to your app, choose Add Form from the Project menu at the top of the screen. Forms can be deleted in the Project Explorer.
Scrolling forms are allowed, with a couple of notes. Footerbars won't work (since the bottom needs to scroll up), nor will scrolling controls (which confuse the scroller).
The information on a form can be submitted to a URL by using the Ajax function.
Properties
Standard properties are supported, plus:
attributes |
The names of HTML attributes which apply to this form, separated by spaces. Design Time.
|
backgroundColor |
Sets the form's background color. Can be a color name, #RRGGBB, rgb(R,G,B), or transparent.
|
backgroundImage |
Sets the form's background pattern or image. Overrides the backgroundColor property. Works best if image is in the project folder. Do not use absolute paths. To stop image from repeating to fill the screen, put background-repeat:no-repeat; into the form's style property. Gradients like linear-gradient(#55aaee,#003366) can be set at design time or runtime. URLs like url(https://www.nsbasic.com/images/eiffel.gif) can be set at runtime only.
|
centerScreen |
If True, the form will be centered on the screen at runtime. Good for different screen sizes. Scrolling must be false. Design Time.
|
class |
The names of CSS classes which apply to this form separated by spaces. Design Time.
|
designHeight |
Used to calculate height if expressed as a percentage. If 0, then same as height in pixels. Design time only.
|
designWidth |
Used to calculate width if expressed as a percentage. If 0, then same as width in pixels. Design time only.
|
fullscreen |
True/False. If True, the form will automatically fill the entire device screen. The IDE will still use height and width at design time. Design time only.
|
height |
The height of the form in pixels or a percent of designHeight.
|
left |
The left position of the form. Use this for forms that are not full screen.
|
locked |
If set to true, the controls on the Design Screen cannot be moved
|
modal |
If set to true, the form will be displayed centered on top of any other forms. Other forms will be grayed out and cannot be accessed until the form is hidden. Design time only.
|
language |
The programming language used in the code for the form. Can be BASIC or JavaScript. Design time only.
|
openMode |
Should the form be open at startup? Use this for forms which are to remain open. There is no need to set this for the first form of the project: that is set in Project Properties. Design time only.
|
parentForm |
The name of the parent form. If blank, the main page (NSBPage) is used. Can be used to make a form a child of another control or form.
|
position |
Determines how a form is positioned. Normally set to 'absolute': the form is positioned according to the left and top properties. If set to 'relative', Responsive Design principles apply.
|
script |
Opens the Code Window for the form.
|
screenMode |
How will the form be displayed?
Full - Screen using full width and height.
Actual - Size of width, height, left and top. Use for Modal forms.
Center - in screen, using width and height.
Zoom - width and height to screen size and center horizontally. Max of 2.
noStyle - no automatic styling, Just use actual class and style properties.
|
scroll_options |
iScroll options. See iScroll docs at https://github.com/cubiq/iscroll.
|
scrolling |
Allow scrolling? Design time only.
|
setFocusID |
The control to get the focus when the form is shown.
|
style |
The CSS style for the form.
|
width |
The width of the form in pixels or percent of designWidtth. Percents can be set at runtime.
|
reset() |
Clear all fields on the form. Runtime only.
|
Xpert
|
HTML |
HTML to display on the form. This HTML is displayed on the form before any controls are rendered. It can be used instead of the Drag and Drop method of the Design Screen.
|
script |
Opens the Code Window for the form.
|
Events
Standard events are supported, plus:
onhide() |
Called when form hidden as a result of ChangeForm()
|
onkeypress(event) |
Called when a key is tapped on a form.
|
onshow() |
Called by firstform and when form is shown as a result of ChangeForm()
|
onsubmit() |
Called when a form is submitted.
|
Example
Form1.style.backgroundColor="red";
Form1.style.width="100%";
// To prevent the image from repeating to fill the full window:
NSBPage.style.backgroundRepeat = "no-repeat";
// Set gradient background at runtime:
Form1.style.backgroundImage="linear-gradient(#55aaee, #003366)";
// Change the theme of a Form at runtime. Needs to be done each time you show a Form:
$("#NSBPage").page({theme: "a"}) // jQuery Mobile
'Change color at runtime
Form1.style.backgroundColor="red"
Form1.style.width="100%"
'To prevent the image from repeating to fill the full window:
NSBPage.style.backgroundRepeat = "no-repeat"
'Set gradient background at runtime:
Form1.style.backgroundImage="linear-gradient(#55aaee, #003366)"
'Change the theme of a Form at runtime. Needs to be done each time you show a Form:
$("#NSBPage").page({theme: "a"}) ' jQuery Mobile
Output
Related Items
ChangeForm, GetUrlParameter, Properties