php 模板名称:Ninja Form
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 模板名称:Ninja Form相关的知识,希望对你有一定的参考价值。
<?php
/*
* Template Name: Ninja Form
*/
?>
<?php get_header(); ?>
<div class="container" style="min-height: 800px;">
<?php
$modelForms = Ninja_Forms()->form(1)->get();
$modelFields = Ninja_Forms()->form(1)->get_fields();
$modelActions = Ninja_Forms()->form(1)->get_actions();
$modelSubmissions = Ninja_Forms()->form(1)->get_subs();
$modelObjects = Ninja_Forms()->form(1)->get_objects();
// debugging
//print_r($model->get_settings());
//print_r(Ninja_Forms()->form(1)->get_fields());
//print_r($modelObjects);
// model forms
$settings = array(
'title' => 'Provide Your Contact Information',
'show_title' => 0
);
$modelForms->update_settings($settings)->save();
// model fields
/*$settings = array(
'type' => 'textbox',
'label' => 'name',
'label_post' => 'inside',
'required' => 1
);
$modelFields->update_settings($settings)->save();*/
// model actions
// model submissions
// model objects
echo do_shortcode('[ninja_form id="1"]');
?>
</div>
<script>
$(document).on('nfFormReady', function(){
var firstName = 'Musab';
var lastName = 'Haouatis';
var businessName = 'preK';
var phoneNumber = '123456789';
var emailAddress = 'macha@gmail.com';
var businessLocation = {
"Option 1": "value1",
"Option 2": "value2",
"Option 3": "value3"
};
$('input[name="firstname"]').val(firstName).trigger('change');
$('input[name="lastname"]').val(lastName).trigger('change');
$('input[name="business_name"]').val(businessName).trigger('change');
$('input[name="phone"]').val(phoneNumber).trigger('change');
$('input[name="email"]').val(emailAddress).trigger('change');
});
</script>
<?php get_footer(); ?>
以上是关于php 模板名称:Ninja Form的主要内容,如果未能解决你的问题,请参考以下文章
WordPress - Ninja Forms:如何以编程方式编辑保存的提交?
使用 Form 标签在 Django 模板中获取模型的名称
表单功能中的 Ninja Forms onsubmit 按钮
Ninja 表单使用 SQL/PHP 填充 Select
php 使用Ninja Forms选择字段预填充
项目搭建模板