0

Form Ajax Disabled

-

Description

This example shows how to disable Ajax form submission.

live demo

Source Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
 /**
 * Form - Ajax Disabled
 * @package jqmPhp
 * @filesource
 */
 
 /**
 * Include the jqmPhp class.
 */
 include '../lib/jqmPhp.php';
 
 /**
 * Create a new jqmPhp object.
 */
 $j = new jqmPhp();
 
 /**
 * Create a new jqmPage object.
 */
 $p = new jqmPage('ajax-disabled');
 $p->title('Ajax Disabled');
 $bt = $p->header()->addButton('', 'index.php#', 'a', 'home', false, false, true);
 $bt->rel('external')->attribute('data-iconpos', 'notext');
 $p->addContent('<h1>Form</h1>');
 
 if(isset($_REQUEST['username'])) {
 $p->addContent('<p style="padding:20px;">Wrong username or password.</p>');
 }
 
 /**
 * Create a new jqmForm object.
 */
 $form = new jqmForm('form1');
 $form->action('form-ajax-disabled.php')->method('post');
 $form->add(new jqmInput('username', 'username', 'text', '', 'Username', '', true));
 $form->add(new jqmInput('password', 'password', 'password', '', 'Password', '', true));
 $form->add(new jqmInput('submit', 'submit', 'submit', 'submit', '', 'b', true));
 /**
 * Disable Form Ajax
 */
 $form->attribute('data-ajax', 'false');
 
 /**
 * Add the page to jqmPhp object.
 */    
 $p->addContent($form);
 
 /**
 * Adding Source Code Links.
 */
 $p->addContent('<p>&nbsp;</p>');
 $list = new jqmListview();
 $list->inset(true)->dividerTheme('a');
 $list->addDivider('Source Code');
 $li = $list->addBasic('form-ajax-disabled.php', 'form-ajax-disabled.php.txt', '', true);
 $li->rel('external')->target('_blank');
 $p->addContent($list);
 
 /**
 * Add the page to jqmPhp object.
 */
 $j->addPage($p);
 
 /**
 * Generate the HTML code.
 */
 echo $j;
?>
live demo
2

Adding Listviews

-

Description

This example shows how to add Listviews to jqmPage, the source is included in jqmPhp Package.

live demo

Source Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
 /**
 * Example 5 - Adding Listviews
 * @package jqmPhp
 * @filesource
 */
 
 /**
 * Include the jqmPhp class.
 */
 include 'lib/jqmPhp.php';
 
 /**
 * Create a new jqmPhp object.
 */
 $j = new jqmPhp();
 
 /**
 * Config 'html' and 'head' tag.
 */
 $j->head()->title('Example 5');
 
 /**
 * Create and config a jqmPage object.
 */
 $p = new jqmPage('example-5');
 $p->theme('b')->title('Example 5');
 $p->header()->theme('a');
 
 /**
 * Create and config a new jqmNavbar object and add items.
 */
 $nav = $p->header()->add(new jqmNavbar(), true);
 $nav->add(new jqmButton('', '', '', 'a', 'example-1.php#', 'EX1', '', false));
 $nav->add(new jqmButton('', '', '', 'a', 'example-2.php#', 'Ex2', '', false));
 $nav->add(new jqmButton('', '', '', 'a', 'example-3.php#', 'EX3', '', false));
 $nav->add(new jqmButton('', '', '', 'a', 'example-4.php#', 'EX4', '', false));
 $nav->add(new jqmButton('', '', '', 'a', '#', 'EX5', '', true));
 
 /**
 * Confif page footer (jqmFooter).
 */
 $p->footer()->addButton('EX1', 'example-1.php#', '', 'arrow-l');
 $p->footer()->addButton('EX2', 'example-2.php#', '', 'arrow-l');
 $p->footer()->addButton('EX3', 'example-3.php#', '', 'arrow-l');
 $p->footer()->addButton('EX4', 'example-4.php#', '', 'arrow-l');
 $p->footer()->addButton('EX5', '#', '', 'check', true);
 
 $p->footer()->group(true)->uiBar(true)->theme('a');
 
 /**
 * Create and config a new jqmListview object and add Basic Items.
 */
 $p->addContent('<h1>Adding Listviews</h1>');
 $p->addContent('<h3>Basic</h3>');
 $list1 = new jqmListviem();
 $list1->addDivider('Basic Examples', '2')->inset(true);
 $list1->addBasic('Example 1', 'example-1.php#');
 $list1->addBasic('Example 2', 'example-2.php#');
 $list1->addDivider('Advanced Examples', '3')->inset(true);
 $list1->addBasic('Example 3', 'example-3.php#');
 $list1->addBasic('Example 4', 'example-4.php#');
 $list1->addBasic('Example 5', '#');
 $p->addContent($list1);
 
 /**
 * Create and config a new jqmListview object and add Icon Items.
 */
 $p->addContent('<h3>Icon</h3>');
 $list2 = new jqmListviem();
 $list2->inset(true)->addDivider('Animals')->dividerTheme('a');
 $list2->addIcon('Dogs', '#', 'docs/images/dog.png', '13');
 $list2->addIcon('Cats', '#', 'docs/images/cat.png', '10');
 $p->addContent($list2);
 
 /**
 * Create and config a new jqmListview object and add Thumbnails Items.
 */
 $p->addContent('<h3>Thumbnails</h3>');
 $list3 = new jqmListviem();
 $list3->inset(true);
 $list3->addThumb('YouTube', 'www.youtube.com', 'http://www.youtube.com', 'docs/images/youtube.png');
 $list3->addThumb('Flickr', 'www.flickr.com', 'http://www.flickr.com', 'docs/images/flickr.png');
 $list3->addThumb('Picasa', 'picasaweb.google.com', 'http://picasaweb.google.com', 'docs/images/picasa.png');
 $list3->addThumb('Feedburner', 'www.feedburner.com', 'http://www.feedburner.com', 'docs/images/feedburner.png');
 $p->addContent($list3);
 
 /**
 * Create and config a new jqmListview object and add Split Items.
 */
 $p->addContent('<h3>Split</h3>');
 $list4 = new jqmListviem();
 $list4->inset(true)->splitIcon('gear')->splitTheme('c');
 $list4->addDivider('Unread Messages', '11')->dividerTheme('c')->countTheme('b');
 $list4->addSplit('Account 1', '#', '#', '09');
 $list4->addSplit('Account 2', '#', '#', '02');
 $list4->addSplit('Account 3', '#', '#', '00');
 $p->addContent($list4);
 
 /**
 * Create and config a new jqmListview object and add Nested Items.
 */
 $p->addContent('<h3>Nested</h3>');
 $list5 = new jqmListviem();
 $list5->inset(true)->theme('a');
 $list5->addDivider('Cars');
 $fiat = new jqmListviem();
 $fiat->addBasic('Bravo', 'example-5.php#');
 $fiat->addBasic('Linea', 'example-5.php#');
 $fiat->addBasic('Punto', 'example-5.php#');
 $list5->addNested('Fiat', $fiat);
 $gm = new jqmListviem();
 $gm->addBasic('Celta', 'example-5.php#');
 $gm->addBasic('Agile', 'example-5.php#');
 $gm->addBasic('Vectra', 'example-5.php#');
 $list5->addNested('GM', $gm);
 $honda = new jqmListviem();
 $honda->addBasic('Fit', 'example-5.php#');
 $honda->addBasic('City', 'example-5.php#');
 $honda->addBasic('Civic', 'example-5.php#');
 $list5->addNested('Honda', $honda);
 $p->addContent($list5);
 
 /**
 * Add the page to jqmPhp object.
 */
 $j->addPage($p);
 
 /**
 * Generate the HTML code.
 */
 echo $j;
?>
live demo
<?php
/**
* Example 5 – Adding Listviews
* @package jqmPhp
* @filesource
*/

/**
* Include the jqmPhp class.
*/
include ‘lib/jqmPhp.php’;

/**
* Create a new jqmPhp object.
*/
$j = new jqmPhp();

/**
* Config ‘html’ and ‘head’ tag.
*/
$j->head()->title(‘Example 5′);

/**
* Create and config a jqmPage object.
*/
$p = new jqmPage(‘example-5′);
$p->theme(‘b’)->title(‘Example 5′);
$p->header()->theme(‘a’);

/**
* Create and config a new jqmNavbar object and add items.
*/
$nav = $p->header()->add(new jqmNavbar(), true);
$nav->add(new jqmButton(”, ”, ”, ‘a’, ‘example-1.php#’, ‘EX1′, ”, false));
$nav->add(new jqmButton(”, ”, ”, ‘a’, ‘example-2.php#’, ‘Ex2′, ”, false));
$nav->add(new jqmButton(”, ”, ”, ‘a’, ‘example-3.php#’, ‘EX3′, ”, false));
$nav->add(new jqmButton(”, ”, ”, ‘a’, ‘example-4.php#’, ‘EX4′, ”, false));
$nav->add(new jqmButton(”, ”, ”, ‘a’, ‘#’, ‘EX5′, ”, true));

/**
* Confif page footer (jqmFooter).
*/
$p->footer()->addButton(‘EX1′, ‘example-1.php#’, ”, ‘arrow-l’);
$p->footer()->addButton(‘EX2′, ‘example-2.php#’, ”, ‘arrow-l’);
$p->footer()->addButton(‘EX3′, ‘example-3.php#’, ”, ‘arrow-l’);
$p->footer()->addButton(‘EX4′, ‘example-4.php#’, ”, ‘arrow-l’);
$p->footer()->addButton(‘EX5′, ‘#’, ”, ‘check’, true);

$p->footer()->group(true)->uiBar(true)->theme(‘a’);

/**
* Create and config a new jqmListview object and add Basic Items.
*/
$p->addContent(‘<h1>Adding Listviews</h1>’);
$p->addContent(‘<h3>Basic</h3>’);
$list1 = new jqmListviem();
$list1->addDivider(‘Basic Examples’, ’2′)->inset(true);
$list1->addBasic(‘Example 1′, ‘example-1.php#’);
$list1->addBasic(‘Example 2′, ‘example-2.php#’);
$list1->addDivider(‘Advanced Examples’, ’3′)->inset(true);
$list1->addBasic(‘Example 3′, ‘example-3.php#’);
$list1->addBasic(‘Example 4′, ‘example-4.php#’);
$list1->addBasic(‘Example 5′, ‘#’);
$p->addContent($list1);

/**
* Create and config a new jqmListview object and add Icon Items.
*/
$p->addContent(‘<h3>Icon</h3>’);
$list2 = new jqmListviem();
$list2->inset(true)->addDivider(‘Animals’)->dividerTheme(‘a’);
$list2->addIcon(‘Dogs’, ‘#’, ‘docs/images/dog.png’, ’13′);
$list2->addIcon(‘Cats’, ‘#’, ‘docs/images/cat.png’, ’10′);
$p->addContent($list2);

/**
* Create and config a new jqmListview object and add Thumbnails Items.
*/
$p->addContent(‘<h3>Thumbnails</h3>’);
$list3 = new jqmListviem();
$list3->inset(true);
$list3->addThumb(‘YouTube’, ‘www.youtube.com’, ‘http://www.youtube.com’, ‘docs/images/youtube.png’);
$list3->addThumb(‘Flickr’, ‘www.flickr.com’, ‘http://www.flickr.com’, ‘docs/images/flickr.png’);
$list3->addThumb(‘Picasa’, ‘picasaweb.google.com’, ‘http://picasaweb.google.com’, ‘docs/images/picasa.png’);
$list3->addThumb(‘Feedburner’, ‘www.feedburner.com’, ‘http://www.feedburner.com’, ‘docs/images/feedburner.png’);
$p->addContent($list3);

/**
* Create and config a new jqmListview object and add Split Items.
*/
$p->addContent(‘<h3>Split</h3>’);
$list4 = new jqmListviem();
$list4->inset(true)->splitIcon(‘gear’)->splitTheme(‘c’);
$list4->addDivider(‘Unread Messages’, ’11′)->dividerTheme(‘c’)->countTheme(‘b’);
$list4->addSplit(‘Account 1′, ‘#’, ‘#’, ’09′);
$list4->addSplit(‘Account 2′, ‘#’, ‘#’, ’02′);
$list4->addSplit(‘Account 3′, ‘#’, ‘#’, ’00′);
$p->addContent($list4);

/**
* Create and config a new jqmListview object and add Nested Items.
*/
$p->addContent(‘<h3>Nested</h3>’);
$list5 = new jqmListviem();
$list5->inset(true)->theme(‘a’);
$list5->addDivider(‘Cars’);
$fiat = new jqmListviem();
$fiat->addBasic(‘Bravo’, ‘example-5.php#’);
$fiat->addBasic(‘Linea’, ‘example-5.php#’);
$fiat->addBasic(‘Punto’, ‘example-5.php#’);
$list5->addNested(‘Fiat’, $fiat);
$gm = new jqmListviem();
$gm->addBasic(‘Celta’, ‘example-5.php#’);
$gm->addBasic(‘Agile’, ‘example-5.php#’);
$gm->addBasic(‘Vectra’, ‘example-5.php#’);
$list5->addNested(‘GM’, $gm);
$honda = new jqmListviem();
$honda->addBasic(‘Fit’, ‘example-5.php#’);
$honda->addBasic(‘City’, ‘example-5.php#’);
$honda->addBasic(‘Civic’, ‘example-5.php#’);
$list5->addNested(‘Honda’, $honda);
$p->addContent($list5);

/**
* Add the page to jqmPhp object.
*/
$j->addPage($p);

/**
* Generate the HTML code.
*/
echo $j;
?>

5

Adding Form Elements

-

Description

This example shows how to add form elements to jqmPage, the source is included in jqmPhp Package.

live demo

Source Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
 /**
 * Example 4 - Adding Form Elements
 * @package jqmPhp
 * @filesource
 */
 
 /**
 * Include the jqmPhp class.
 */
 include 'lib/jqmPhp.php';
 
 /**
 * Create a new jqmPhp object.
 */
 $j = new jqmPhp();
 
 /**
 * Config 'html' and 'head' tag.
 */
 $j->head()->title('Example 4');
 
 /**
 * Create and config a jqmPage object.
 */
 $p = new jqmPage('example-4');
 $p->theme('b')->title('Example 4');
 $p->header()->theme('a');
 
 /**
 * Create and config a new jqmNavbar object and add items.
 */
 $nav = $p->header()->add(new jqmNavbar(), true);
 $nav->add(new jqmButton('', '', '', 'a', 'example-1.php#', 'EX1', '', false));
 $nav->add(new jqmButton('', '', '', 'a', 'example-2.php#', 'Ex2', '', false));
 $nav->add(new jqmButton('', '', '', 'a', 'example-3.php#', 'EX3', '', false));
 $nav->add(new jqmButton('', '', '', 'a', '#', 'EX4', '', true));
 $nav->add(new jqmButton('', '', '', 'a', 'example-5.php#', 'EX5', '', false));
 
 /**
 * Confif page footer (jqmFooter).
 */
 $p->footer()->addButton('EX1', 'example-1.php#', '', 'arrow-l');
 $p->footer()->addButton('EX2', 'example-2.php#', '', 'arrow-l');
 $p->footer()->addButton('EX3', 'example-3.php#', '', 'arrow-l');
 $p->footer()->addButton('EX4', '#', '', 'check', true);
 $p->footer()->addButton('EX5', 'example-5.php#', '', 'arrow-r');
 $p->footer()->group(true)->uiBar(true)->theme('a');
 
 /**
 * Create and config a new jqmForm object and add items.
 */
 $p->content()->add('<h1>Adding Form Elements</h1>');
 $form = $p->addContent(new jqmForm(), true);
 $form->action('example-4.php?rand='.rand(0, 9999))->method('POST');
 
 /**
 * Add some jqmInput objects.
 */
 $form->add('<h3>Text Inputs</h3>');
 $form->add(new jqmInput('uid', 'uid', 'text', '', 'Username:', '', true));
 $form->add(new jqmInput('pwd', 'pwd', 'password', '', 'Password:', '', true));
 $form->add(new jqmInput('find', 'find', 'search', '', 'Search:', '', true));
 
 /**
 * Add a jqmTextarea object.
 */
 $form->add('<h3>Textarea</h3>');
 $form->add(new jqmTextarea('msg', 'msg', '', '80', '4', 'Comments:', '', true));
 
 /**
 * Add a jqmRange object.
 */
 $form->add('<h3>Range Input Type</h3>');
 $form->add(new jqmRange('age', 'age', '18', '18', '80', 'Age:', '', true));
 
 /**
 * Add a jqmSelect object with some jqmOption objects.
 */
 $form->add('<h3>Select</h3>');
 $sel = $form->add(new jqmSelect('country', 'country', 'Language:'), true);
 $sel->add(new jqmOption('English', 'en', true));
 $sel->add(new jqmOption('Spanish', 'es', false));
 $sel->add(new jqmOption('Portuguese', 'pt', false));
 $sel->add(new jqmOption('Other', '', false));
 $sel->fieldContain(true);
 
 /**
 * Add and config a jqmSelect object with some jqmOption objects.
 */
 $form->add('<h3>Select Inline</h3>');
 $sex = $form->add(new jqmSelect('sex', 'sex', 'Sex:', '', '', true), true);
 $sex->addOption('Male', 'male', true);
 $sex->addOption('Female', 'female', false);
 $sex->inline(true)->icon('grid')->theme('a');
 
 /**
 * Add a jqmSlider object.
 */
 $form->add('<h3>Select Slider</h3>');
 $form->add(new jqmSlider('yesno', 'yesno', 'Accept:', true, 'Yes', '1', 'No', '0', '', true));
 
 /**
 * Add and config a jqmRadiogroup object.
 */
 $form->add('<h3>Radio Group</h3>');
 $rg = $form->add(new jqmRadiogroup('plan', 'plan', 'Select your plan:'), true);
 $rg->addRadio('Silver', '0');
 $rg->addRadio('Gold', '1');
 $rg->addRadio('Diamond', '3', '', true);
 $rg->fieldContain(true);
 
 /**
 * Add and config a jqmCheckgroup object.
 */
 $form->add('<h3>Checkbox Group</h3>');
 $cg = $form->add(new jqmCheckboxgroup(), true);
 $cg->legend('Favorite Search Engine:');
 $cg->addCheckbox('se1', 'se1', 'Bing');
 $cg->addCheckbox('se2', 'se2', 'Google');
 $cg->addCheckbox('se3', 'se3', 'Yahoo')->fieldContain(true);
 
 /**
 * Add a new jqmInput object (submit button).
 */
 //$form->add(new jqmInput('', '', 'submit', 'Send Now', '', 'b'));
 
 /**
 * Add and config a jqmButton object with data-rel="dialog".
 */
 $send = $form->add(new jqmButton(), true);
 $send->text('Send Now')->href('example-1.php?rand='.rand(0, 9999))->attribute('data-rel', 'dialog');
 
 /**
 * Add the page to jqmPhp object.
 */
 $j->addPage($p);
 
 /**
 * Generate the HTML code.
 */
 echo $j;
?>
live demo