CSS/HTML Twitter bootstrap fixed columns - javascript

I'm trying to get some elements on my webpage to stay where they are when scrolling (fixed), but I can't seem to get it working using position:fixed;.
When I try the design gets pretty broken. Everything moves to the right side, and is getting 100% in width automatically. All elements I want to set fixed also stays on top of each other...
This is how it is supposed to look...
The header (blue bar) and the row below is going to stay fixed where it is. How would I do that using Twitters Bootstrap?
Here is some HTML:
<div class="container">
<div class="row">
<div id="search_wrapper" class="col-md-8 col-md-offset-2 grey">
<div id="search" class="col-md-12">
<div class="threed left"></div>
<div class="threed right"></div>
<div class="logo_small"></div>
<form method="post" class="search">
<div class="form-group">
<button class="form-control-feedback pull-right" type="submit" name="submit_search"><i class="fa fa-search"></i></button>
<input type="text" name="q" placeholder="Søk etter firma, bransje og sted">
</div>
</form>
</div>
</div>
<div class="wrapper col-md-8 col-md-offset-2">
<div id="locals_wrapper" class="col-md-3 grey">
<h3><i class="fa fa-map-marker"></i>Steder</h3>
<hr>
<?php
if (isset($data['location']) && $data['location']) {
foreach ($data['location'] as $c => $ms) {
echo '<div class="county checkbox"><label> <input class="c" type="checkbox" name="business_county" value="'. $c .'">'. $c .' </label><div class="municipalities" data-county="'. $c .'">';
foreach ($ms as $m) {
echo '<div class="checkbox"><label><input type="checkbox" name="business_municipality" data-county="'. $c .'" value="'. $m .'">'. $m .'</label></div>';
} echo '</div></div>';
}
}
?>
</div>
<div id="results_wrapper" class="col-md-9 grey">
<h3><i class="fa fa-bullseye"></i>Resultater</i></h3>
<hr>
<div id="results">
</div>
</div>
</div>
</div>
</div>
I have tried adding position:fixed; to #search, #wrapper.

Related

How to show a html hidden div after clicking a submit button in another php file

I have this div in seosystem/index.php
<div class="class" id="ScoreResult" style="display:none;">
<div class="row border border-5 " style="background:whitesmoke;">
<div class=" col toast w-20 z-depth-5 shadow-lg p-3 mb-5 bg-white rounded show w-100">
<div class="toast-header">
<strong class="me-auto">Description</strong>
<!-- <button type="button" class="btn-close" data-bs-dismiss="toast"></button> !-->
</div>
<div class="toast-body ">
<div class="progress" style="height:20px; width:200px;">
<div class="progress-bar bg-success" style="width:33.33%"></div>
<div class="progress-bar bg-warning" style="width:33.33%"> </div>
<div class="progress-bar bg-danger" style="width:33.33%"> </div>
</div>
<p>10/10</p>
</div>
</div>
<div class="col-sm border border-5 col-xxl mx-auto">
<h4><?php echo "Title: " . $title; ?></h4>
<?php echo "<iframe style=\"background-color:whitesmoke;\" position=\"center\"allow=\"accelerometer\"; gyroscope; width=\"100%\" height=\"315\" src=\"http://www.youtube.com/embed/$ytcode\" frameborder=\"0\" allowfullscreen></iframe></div>";
?>
</div>
</div>
and i have this function in seosystem/controller/youtubedata.php i tried using Js it didn't work
so i want when the user submit the button it shows the div to display the data
if($_SERVER['REQUEST_METHOD'] == "GET" && isset($_GET['url']) && isset($_GET['submit'])){
/* echo "</br >" ;
echo $input_Url_data . "Button clicked" ; */
$id_position = strstr($input_Url_data,"=");
$id_position = trim($id_position, "=" );
echo '<script type="text/javascript">',
'showtable(){
document.getElementById(<?php echo "ScoreResult" ;?>).style.display = "block";
}',
'</script>' ;
}
This the form of the input and the button i'm not sure should i make the action index.php or seosystem/controller/youtubedata.php
<form class="d-flex justify-content-center " method="GET" action="index.php">
<div class="input-group ">
<input type="text" class="form-control" name="url" placeholder="Enter Youtube Video URL" aria-label="Example text with button addon" aria-describedby="button-addon1">
<input class="btn" value="Analyze" name="submit" type="submit" id="button-addon1"></input>
</div>
</form>
two invalid variables there.. TITLE & YTCODE. Well I don't know how you got those.
But to display the DIV Only when response is valid here's the code;
youtube.php
<?php
if($_SERVER['REQUEST_METHOD'] == "GET" && isset($_GET['url']) && isset($_GET['submit'])){
/* echo "</br >" ;
echo $input_Url_data . "Button clicked" ; */
$id_position = strstr($input_Url_data,"=");
$id_position = trim($id_position, "=" );
$verified_success = "yes"; // This is the conditional variable.
/* echo '<script type="text/javascript">',
'showtable(){
document.getElementById(<?php echo "ScoreResult" ;?>).style.display = "block";
}',
'</script>' ; */
}
index.php
<?php
// Stop Irrelevant Warning Signs From Showing such as invalid variables
error_reporting(E_ERROR | E_PARSE);
include("youtube.php");
?>
<?php
if ($verified_success == NULL) {
?>
<form class="d-flex justify-content-center " method="GET" action="">
<div class="input-group ">
<input type="text" class="form-control" name="url" placeholder="Enter Youtube Video URL" aria-label="Example text with button addon" aria-describedby="button-addon1">
<input class="btn" value="Analyze" name="submit" type="submit" id="button-addon1"></input>
</div>
</form>
<?php } ?>
<?php
if ($verified_success != NULL) {
?>
<div class="class" id="ScoreResult">
<div class="row border border-5 " style="background:whitesmoke;">
<div class=" col toast w-20 z-depth-5 shadow-lg p-3 mb-5 bg-white rounded show w-100">
<div class="toast-header">
<strong class="me-auto">Description</strong>
<!-- <button type="button" class="btn-close" data-bs-dismiss="toast"></button> !-->
</div>
<div class="toast-body ">
<div class="progress" style="height:20px; width:200px;">
<div class="progress-bar bg-success" style="width:33.33%"></div>
<div class="progress-bar bg-warning" style="width:33.33%"> </div>
<div class="progress-bar bg-danger" style="width:33.33%"> </div>
</div>
<p>10/10</p>
</div>
</div>
<div class="col-sm border border-5 col-xxl mx-auto">
<h4><?php echo "Title: " . $title; ?></h4>
<?php echo "<iframe style=\"background-color:whitesmoke;\" position=\"center\"allow=\"accelerometer\"; gyroscope; width=\"100%\" height=\"315\" src=\"http://www.youtube.com/embed/$ytcode\" frameborder=\"0\" allowfullscreen></iframe></div>";
?>
</div>
</div>
<?php } ?>

I have a business sales page that shows results from a json file. I want to be able to pass the information for one listing on a results page [duplicate]

This question already has answers here:
PHP Pass variable to next page
(9 answers)
Closed 1 year ago.
My index.php page has a display of listings from a json file which looks good. But I am trying to send a result of a single listing from that page to another page (result.php). How do I display the results of that single listing to the new page?
Here is the code for my first page that is attached to the json file:
<?php
$filename = file_get_contents("/ListingCollection.json");
$listings = json_decode($filename);
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<script src="https://kit.fontawesome.com/ac048d9955.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<div style="margin-left:150px; margin-right:150px; margin-bottom:150px;">
<?php foreach ($listings as $listing) { ?>
<span style="visibility:hidden;"><?= $listing->Oid; ?></span>
<div class="row align-items-center border-top">
<div class="col-3" style="padding:10px;">
<?= $listing->AdPhoto; ?>
</div>
<div class="row col-8" style="margin-left:10px;">
<div class="col-8 align-items-center">
<h2 style="color:#00471C; width: 700px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" type="button"><?= $listing->AdTitle; ?></h2>
<h3><?= $listing->AdTagLine; ?></h3>
<p><?= $listing->AdTagLine; ?></p>
</div>
<div class="col-4 align-items-start">
<center><h1><?= $listing->ListingPrice; ?></h1><h3>EBITDA: $<?= $listing->EBITDA; ?></h3></center><br><br>
<center><a class="btn btn-primary" href="<?= $listing->WebsiteURL; ?>?<?= $listing->Oid; ?>" role="button">See Listing</a></center>
</div>
</div>
</div>
<?php } ?>
</div>
</body>
</html>
Here is the code to my second page that I want to pull from single listing of index.php file:
<?php
require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');
get_header();
$filename = file_get_contents("/ListingCollection.json");
$listings = json_decode($filename);
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<script src="https://kit.fontawesome.com/ac048d9955.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<div style="margin-left:150px; margin-right:150px; margin-top:50px; margin-bottom:50px;">
<?php foreach ($listings as $listing) { ?>
<!-- Ad Header -->
<div class="row align-items-center" style="margin-bottom:25px;">
<div class="col-12">
<h1><?= $listing->AdTitle; ?></h1>
<h3><?= $listing->County; ?>, <?= $listing->State; ?></h3>
</div>
</div>
<!-- Ad Photo -->
<div class="row" style="margin-bottom:25px;">
<div class="row col-8 align-items-center">
<div class="col-12">
<?= print "Your registration is: ".$regValue."."; ?>
<?= $listing->AdPhoto; ?><br><br>
</div>
<!-- Ad Pricing -->
<div class="col-6">
<h2>ASKING PRICE: $<?= $listing->ListingPrice; ?></h2>
</div>
<div class="col-6">
<h2>CASH FLOW: $<?= $listing->CashFlow; ?></h2>
</div>
<!-- Above button info -->
<div class="col-3">Gross Revenue: </div><div class="col-3">$<?= $listing->GrossRevenue; ?> </div><div class="col-3">Inventory: </div><div class="col-3">$<?= $listing->Inventory; ?></div>
<div class="col-3">EBITDA: </div><div class="col-3">$<?= $listing->EBITDA; ?> </div><div class="col-3">Rent: </div><div class="col-3">$<?= $listing->Rent; ?> </div>
<div class="col-3">FF&E: </div><div class="col-3">$<?= $listing->FFandE; ?> </div><div class="col-3">Established: </div><div class="col-3"><?= $listing->YearEstablished; ?> </div><br><br>
<!-- buttons -->
<div class="col-3">
<a class="btn btn-primary" style="width:100%;" type="button" href="">SAVE</a>
</div>
<div class="col-3">
<a class="btn btn-primary" style="width:100%;" type="button" href="">PRINT</a>
</div>
<div class="col-3">
<a class="btn btn-primary" style="width:100%;" type="button" href="">SHARE</a>
</div>
<div class="col-3">
<a class="btn btn-primary" style="width:100%;" type="button" href="">VALUATION REPORT</a>
</div>
<!-- Ad Description -->
<div class="col-12"><br><br><hr><br>
<h2>DESCRIPTION</h2>
<h2><?= $listing->AdTagLine; ?></h2>
<?= $listing->AdDescription ?><br>
<hr><br>
</div>
<!-- Ad Details -->
<div class="col-3">
<h3>Location:</h3>
</div>
<div class="col-9">
<?= $listing->County ?>
</div>
<div class="col-3">
<h3>Building SF:</h3>
</div>
<div class="col-9">
<?= $listing->TotalSqFt ?>
</div>
<div class="col-3">
<h3>Employees:</h3>
</div>
<div class="col-9">
<?= $listing->EmployeeCount ?>
</div>
<div class="col-3">
<h3>Facilities:</h3>
</div>
<div class="col-9">
<?= $listing->AdFacilityDescription ?>
</div>
<div class="col-3">
<h3>Competition:</h3>
</div>
<div class="col-9">
<?= $listing->AdCompetitiveAnalysis ?>
</div>
<div class="col-3">
<h3>Growth & Expansion:</h3>
</div>
<div class="col-9">
<?= $listing->AdOpportunityForGrowth ?>
</div>
<div class="col-3">
<h3>Support & Training:</h3>
</div>
<div class="col-9">
<?= $listing->AdSupportAndTraining ?>
</div>
<div class="col-3">
<h3>Reason for Selling:</h3>
</div>
<div class="col-9">
<?= $listing->AdReasonForSelling ?>
</div>
<div class="col-3">
<h3>Business Website:</h3>
</div>
<div class="col-9">
<?= $listing->WebsiteURL ?>
</div>
</div>
<div class="col-4 bg-light">
<div class="container">
<!-- CHANGE THE URL HERE -->
<div class="col-12">
<form action="https://app.99inbound.com/e/123" method="POST" target="_blank">
<h1 style="text-align: center;"><br>CONTACT US</h1>
<div class="form-group">
<input name="name" type="text" class="form-control" id="name" placeholder="Full Name" required>
<input name="phone" type="phone" class="form-control" id="phone" placeholder="Phone Number" required>
<input name="email" type="email" class="form-control" id="email" placeholder="Enter Email" required>
</div>
<div class="form-group">
<textarea name="message" class="form-control" id="message" rows="5" placeholder="Enter message" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<br><hr>
</div>
<div class="row col-12">
<div class="col-6"><p>Business Listed By:<br>
<?= $listing->SellerFirstName; ?> <?= $listing->SellerLastName; ?></p></div>
<div class="col-6"><p><i class="fas fa-phone-square-alt"></i> <?= $listing->SellerPhone; ?></div>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
<?php get_footer(); ?>
</body>
</html>
I might make a subtle change to the link to turn the ?id into a key/value pair, like
<center><a class="btn btn-primary" href="<?= $listing->WebsiteURL; ?>?display=<?= $listing->Oid; ?>" role="button">See Listing</a></center>
Then on the second page
<?php
require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');
get_header();
$filename = file_get_contents("/ListingCollection.json");
$display = $_GET['display'];
$listings = json_decode($filename);
$listing=array_filter($listings, function($a) use($display) {
return $a->Oid === $display;
});
$listing = array_values($listing)[0];
// get rid of the loop on this page
// foreach ($listings as $listing) { <-- GONE
?>
<!-- then the rest of your code, using $listing -->
I fixed the problem by doing this to the button:
<?php echo"<a class='btn btn-primary' role='button' href='https://samplesite.com/result.php?" . http_build_query($listing) . "'>See Listing</a>"; ?>
Then echoing the items on the results page.

Dynamically split div columns

code i have written below is working fine but at the end of the looping the div is not closed its still opening a loop
<div class="carousel-inner">
<div class="item active">
<div class="row">
<?php
$recent_projects_sql="SELECT * from recent_projects where service_type='upholstery'";
$recent_projects_conn=mysql_query($recent_projects_sql) or die(mysql_error());
$i=0; $split=0;
while($projects=mysql_fetch_array($recent_projects_conn)) {
$i++;
?>
<div class="col-sm-3">
<div class="col-item" style="">
<div class="photo-shadow"></div>
<div class="photo">
<img src="admin/assets/images/uploads/projects/<?php echo $projects['attachment1']; ?>" alt="User one">
</div>
<div class="info">
<div class="name">
<?php echo $projects['service_name']; ?>
</div>
<div class="degination">
<?php echo $projects['sub_title']; ?>
</div>
<div class="buttons">
<a class="btn btn-theme ripple-effect" href="#">View More</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<?php
$split++;
if ($split % 4 == 0){
echo '</div></div><div class="item"><div class="row">';
}
}
?>
</div>
</div>
</div>
The Div has splited very well but in end of the loop div has not been closed. Thats only the problem please provide me the help to sort out the problem
When I inspect the element the last loop will show at the given result as follows:
<div class="col-sm-3">
<div class="col-item">
<div class="photo-shadow"></div>
<div class="photo">
<img src="admin/assets/images/uploads/projects/1557301934.jpg" alt="User one">
</div>
<div class="info">
<div class="name">UPHOLSTERY</div>
<div class="degination">UPHOLSTERY</div>
<div class="buttons">
<a class="btn btn-theme ripple-effect" href="#">View More</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div></div><div class="item"><div class="row">
I want to remove the two opening div's as dynamically. How can i set this to remove opened div's at then end of the looping
You can do this:
<div class="carousel-inner">
<?php
$recent_projects_sql="SELECT * from recent_projects where service_type='upholstery'";
$recent_projects_conn=mysql_query($recent_projects_sql) or die(mysql_error());
$i=0; $split=0;
while($projects=mysql_fetch_array($recent_projects_conn)) {
$i++;
?>
<div class="item <?php if($i==1) echo "active";?>">
<div class="row">
<div class="col-sm-3">
<div class="col-item" style="">
<div class="photo-shadow"></div>
<div class="photo">
<img src="admin/assets/images/uploads/projects/<?php echo $projects['attachment1']; ?>" alt="User one">
</div>
<div class="info">
<div class="name">
<?php echo $projects['service_name']; ?>
</div>
<div class="degination">
<?php echo $projects['sub_title']; ?>
</div>
<div class="buttons">
<a class="btn btn-theme ripple-effect" href="#">View More</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>

How to replace text as an input and editable

Let me start by saying I'm a total beginner at JavaScript/jQuery. I've just started learning it because I want to use some JavaScript features for my website.
What I want to achieve is the following when you click on the edit button:
Before:
<div class="container container-table">
<div class="row content">
<div class="col-md-4 text-center">
<div class="container">
<div class="well well-sm">
<div>
<strong>Alle producten</strong>
</div>
</div>
<div id="products" class="row list-group">
<?php
$items = $dbh->SelectAllproduct();
foreach ($items as $item) {
$id = $item['idproduct'];
if ($item['bijnaop']==0){
$status = "Het product is niet op";
}
if ($item['bijnaop']==1) {
$status = "Het product is bijna op";
}
if ($item['op']==1) {
$status = "Het product is helaas op";
}
echo '<div class="item col-xs-12 col-lg-4 col-md-6">
<div class="thumbnail">
<img class="group list-group-image" src="' . $item['productplaatje'] . '" alt="" />
<div class="caption">
<h4 class="group inner list-group-item-heading">
' . $item['productnaam'] . '</h4>
<p class="group inner beschrijving list-group-item-text">
' . $item['productbeschrijving'] . ' <br> Allergieen: '. $item ['allergieen'].'</p>
<div class="row">
<div class="col-xs-12 col-md-6">
<p class="lead">
€ ' . $item['productprijs'] . ' </p>
</div>
<div class="col-xs-6 col-md-6" >
'.$status.'
</div>
<div class="col-xs-6 col-md-6">
<input type="button" href="#" name="'.$item['productnaam'].'" value = "Voeg toe"></a>
</div>
</div>
</div>
</div>
</div>';
}
?>
</div>
</div>
</div>
</div>
</div>
After:
<body>
<div class="container container-table">
<div class="row content">
<div class="col-md-4 text-center">
<div class="container">
<div class="well well-sm">
<div>
<strong>Alle producten</strong>
</div>
</div>
<div id="products" class="row list-group">
<?php
$items = $dbh->SelectAllproduct();
foreach ($items as $item) {
$id = $item['idproduct'];
if ($item['bijnaop']==0){
$status = "Het product is niet op";
}
if ($item['bijnaop']==1) {
$status = "Het product is bijna op";
}
if ($item['op']==1) {
$status = "Het product is helaas op";
}
echo '
<div class="item col-xs-12 col-lg-4 col-md-6">
<div class="thumbnail">
<img class="group list-group-image" src="' . $item['productplaatje'] . '" alt="" />
<input type ="text" value="' . $item['productplaatje'] . '">
<div class="caption">
<h4 class="group inner list-group-item-heading">
<input type ="text" value = "' . $item['productnaam'] . '">
</h4>
<p class="group inner beschrijving list-group-item-text">
<input type ="text" value="'. $item['productbeschrijving'] . '">
</p>
<p>
<input type ="text" value = "Allergieen: '. $item ['allergieen'].'">
</p>
<div class="row">
<div class="col-xs-12 col-md-6">
<p class="lead">
<input type = "text" value="€' . $item['productprijs'] . ' "
</p>
</div>
<div class="col-xs-6 col-md-6">
</div>
</div>
</div>
</div>
</div>';
}
?>
</div>
</body>
I've looked at different scripts on how to replace divs with input, but every time it just doesn't work when I test it myself or it isn't exactly what I wanted.
Edit: will add code in a few min
You can just change the divs contentEditable="true" , then style them they they look like inputs. Then remove contentEditable altogether to accept changes.

Switch between adding and deleting html based on dropdown box

I am trying to building a form that is used for creating other form. I fill out all the information and it creates a json string that is stored in a database. I have my form built and I'm able to add multiple form fields dynamically. However, I'm wanting the fields options to change as I change the field type in a dropdown select box. For instance, if I select the field type "text", only the "required" checkbox will appear, but if I select the "select" type, the "required" checkbox will appear and the "options" textboxes will appear. Each different option is within their own div container. I don't want to just simply hide and show the divs based on the dropdown selection, because I don't want the empty textboxes or checkboxes to post when I submit the form.
I am very new to jQuery. Am I able to use html templates? and how if so? I hope this makes since. I would be happy to explain further.
'
<?php echo validation_errors(); ?>
<?php echo form_open(); ?>
<div class="form-horizontal">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">General</li>
<li role="presentation">Fields</li>
<li role="presentation">After Submit</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="html-container"></div>
<br>
<!-- GENERAL FORM INFO TAB -->
<div role="tabpanel" class="tab-pane active" id="general">
<div class="form-group">
<label for="name" class="col-sm-3 control-label">Name:</label>
<div class="col-sm-5">
<?php echo form_input('name', set_value('name', $form->name), 'class="form-control"'); ?>
</div>
</div>
<div class="form-group">
<label for="slug" class="col-sm-3 control-label">Slug:</label>
<div class="col-sm-5">
<?php echo form_input('slug', set_value('slug', $form->slug), 'class="form-control"'); ?>
</div>
</div>
<div class="form-group">
<label for="send_button_text" class="col-sm-3 control-label">Send Button Text:</label>
<div class="col-sm-5">
<?php echo form_input('send_button_text', set_value('send_button_text', $form->send_button_text), 'class="form-control"'); ?>
</div>
</div>
<div class="form-group">
<label for="save_entries" class="col-sm-3 control-label">Save Entries</label>
<div class="col-sm-5">
<label class="radio-inline">
<?php echo form_radio('save_entries', 'yes', set_value('save_entries', $form->save_entries)); ?> Yes
</label>
<label class="radio-inline">
<?php echo form_radio('save_entries', 'no', set_value('save_entries', $form->save_entries)); ?> No
</label>
</div>
</div>
<div class="form-group">
<label for="is_public" class="col-sm-3 control-label">Public</label>
<div class="col-sm-5">
<label class="radio-inline">
<?php echo form_radio('is_public', 'yes', set_value('is_public', $form->is_public)); ?> Yes
</label>
<label class="radio-inline">
<?php echo form_radio('is_public', 'no', set_value('is_public', $form->is_public)); ?> No
</label>
</div>
</div>
</div> <!-- //..end of 'general' tab panel -->
<!-- INPUT FIELDS TAB -->
<div role="tabpanel" class="tab-pane" id="fields">
<div class="repeat">
<div class="repeat-wrapper">
<div class="repeat-container">
<div class="repeat-template repeat-row">
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading{{row-count}}">
<h3 class="panel-title pull-left">
<span class="move"><span class="glyphicon glyphicon-minus" aria-hidden="true"></span></span>
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse{{row-count}}" aria-expanded="true" aria-controls="collapse{{row-count}}">
Panel title
</a>
</h3>
<?php echo form_button('remove_field_button', '<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Remove', 'class="remove btn btn-link pull-right"'); ?>
<div class="clearfix"></div>
</div>
<div id="collapse{{row-count}}" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading{{row-count}}">
<div class="panel-body">
<div class="form-group form-group-sm">
<label for="inputs[{{row-count}}][name]" class="col-sm-2 control-label">Name:</label>
<div class="col-sm-5">
<?php echo form_input('inputs[{{row-count}}][name]', '', 'class="form-control"'); ?>
</div>
</div>
<div class="form-group form-group-sm">
<label for="inputs[{{row-count}}][label]" class="col-sm-2 control-label">Label:</label>
<div class="col-sm-5">
<?php echo form_input('inputs[{{row-count}}][label]', '', 'class="form-control"'); ?>
</div>
</div>
<div class="form-group form-group-sm">
<label for="inputs[{{row-count}}][type]" class="col-sm-2 control-label">Type:</label>
<div class="col-sm-3">
<?php echo form_dropdown('inputs[{{row-count}}][type]', $types, '', 'class="form-control input_type" data-counter="{{row-count}}"'); ?>
</div>
</div>
<div id="input_required_{{row-count}}" class="form-group input-type-show-hide">
<div class="col-sm-offset-2 col-sm-5">
<div class="checkbox">
<label>
<?php echo form_checkbox('inputs[{{row-count}}][required]', 'yes', ''); ?>
<?php echo form_checkbox('inputs[{{row-count}}][required]', 'no', ''); ?> Required
</label>
</div>
</div>
</div>
<div id="input_options_{{row-count}}" class="row input-type-show-hide">
<div class="col-sm-offset-2 col-sm-10">
<table class="table repeat-wrapper">
<thead>
<tr>
<th>Label</th>
<th>Value</th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="3">
<div class="form-group">
<div class="col-sm-12">
<?php echo form_button('add_option_button', 'Add Option', 'class="add btn btn-link"'); ?>
</div>
</div>
</td>
<td></td>
</tr>
</tfoot>
<tbody class="repeat-container">
<tr class="form-inline repeat-template repeat-row">
<td>
<div class="form-group form-group-sm">
<label for="inputs[{{row-count}}][options][{{row-count}}][label]" class="sr-only">Label</label>
<div class="col-sm-6">
<?php echo form_input('inputs[{{row-count}}][options][{{row-count}}][label]', '', 'class="form-control" placeholder="Label"'); ?>
</div>
</div>
</td>
<td>
<div class="form-group form-group-sm">
<label for="inputs[{{row-count}}][options][{{row-count}}][value]" class="sr-only">Value</label>
<div class="col-sm-6">
<?php echo form_input('inputs[{{row-count}}][options][{{row-count}}][value]', '', 'class="form-control" placeholder="Value"'); ?>
</div>
</div>
</td>
<td>
<span class="remove">Remove</span>
</td>
</tr> <!-- //..end of repeat-template for options -->
</tbody> <!-- //..end of repeat-container for options -->
</table> <!-- //..end of repeat-wrapper for options -->
</div>
</div>
<div class="att_block_{{row-count}}"></div>
</div> <!-- //..end of panel body -->
</div> <!-- //..end of tabpanel -->
</div> <!-- //..end of panel div -->
</div> <!-- //..end of panel group -->
</div> <!-- //..end of repeat-template -->
</div> <!-- //..end of repeat-container -->
<div class="form-group">
<div class="col-sm-12">
<?php echo form_button('add_field_button', 'Add Another', 'class="add btn btn-link"'); ?>
</div>
</div> <!-- //..end of 'add another' form-group -->
</div><!-- //..end of repeat-wrapper -->
</div> <!-- //..end of repeat div -->
</div> <!-- //..end of 'fields' tab panel -->
<!-- AFTER SUBMIT TAB -->
<div role="tabpanel" class="tab-pane" id="after_submit">
<div class="form-group">
<label for="email_recipients" class="col-sm-3 control-label">Email Recipients:</label>
<div class="col-sm-5">
<?php echo form_input('email_recipients', set_value('email_recipients', $form->email_recipients), 'class="form-control"'); ?>
</div>
</div>
<div class="form-group">
<label for="email_cc" class="col-sm-3 control-label">Email CC:</label>
<div class="col-sm-5">
<?php echo form_input('email_cc', set_value('email_cc', $form->email_cc), 'class="form-control"'); ?>
</div>
</div>
<div class="form-group">
<label for="email_bcc" class="col-sm-3 control-label">Email BCC:</label>
<div class="col-sm-5">
<?php echo form_input('email_bcc', set_value('email_bcc', $form->email_bcc), 'class="form-control"'); ?>
</div>
</div>
<div class="form-group">
<label for="email_subject" class="col-sm-3 control-label">Email Subject:</label>
<div class="col-sm-5">
<?php echo form_input('email_subject', set_value('email_subject', $form->email_subject), 'class="form-control"'); ?>
</div>
</div>
<div class="form-group">
<label for="email_message" class="col-sm-3 control-label">Email Message:</label>
<div class="col-sm-6">
<?php echo form_textarea('email_message', set_value('email_message', $form->email_message), 'class="tinymce"'); ?>
</div>
</div>
<div class="form-group">
<label for="after_submit_text" class="col-sm-3 control-label">After Submit Text:</label>
<div class="col-sm-6">
<?php echo form_textarea('after_submit_text', set_value('after_submit_text', $form->after_submit_text), 'class="tinymce"'); ?>
</div>
</div>
<div class="form-group">
<label for="return_url" class="col-sm-3 control-label">Return URL:</label>
<div class="col-sm-5">
<?php echo form_input('return_url', set_value('return_url', $form->return_url), 'class="form-control"'); ?>
</div>
</div>
</div> <!-- //..end of 'after_submit' tab panel -->
</div> <!-- //..end of tab-content -->
<div class="form-group">
<div class="col-sm-offset-3 col-sm-5">
<?php echo form_submit('submit', 'Save', 'class="btn btn-default"'); ?>
</div>
</div>
</div>
</form>
<script>
$(document).ready(function() {
$('#myTabs a').click(function (e) {
e.preventDefault();
$(this).tab('show');
});
tinymce.init({
selector: ".tinymce",
plugins: "code",
toolbar: "undo redo | bold italic | bullist numlist | code",
menubar: false
});
$('.repeat').each(function() {
$(this).repeatable_fields({
wrapper: '.repeat-wrapper',
container: '.repeat-container',
row: '.repeat-row',
template: '.repeat-template',
row_count_placeholder: '{{row-count}}'
});
});
template = $("#test_html").clone();
template.appendTo(".html-container");
//$( ".html-container" ).append( $( "#test_html" ) );
$("body").on("change", ".input_type", function () {
});
});
</script>'
Use the jQuery hide() method to conceal parts of the DOM which you want to be submitted with the form and use remove() to take them completely out of the DOM, thereyby preventing their submission.
See the jQuery remove method

Categories

Resources