Submit button disappears when clicked - javascript

When you fill in the form and click the "Start Earning" button the button disappears!!! It still goes through and goes to the next page so that much works but I have no idea why the button disappears.... Any ideas???
<?php /*** Form begins here ***/ ?>
<form method="post" action="redirect.php" name="home_sub" accept-charset="utf-8" id="home_sub">
<div class="form_fields">
<p><label for="first_name" class="over">First Name:</label>
<input name="first_name" id="first_name" class="text_input required" type="text" value="" onClick="$('#optinsection').show()" /></p>
<p><label for="last_name" class="over">Last Name:</label>
<input name="last_name" id="last_name" class="text_input required" type="text" value="" onClick="$('#optinsection').show()" /></p>
<p><label for="email" class="over">E-mail:</label>
<input name="subscriber_email" id="email" class="text_input xverify_email required" type="text" value="" onClick="$('#optinsection').show()" autocomplete="off" /></p>
<p><label for="custom_Address" class="over">Address:</label>
<input name="custom_Address" type="text" id="custom_Address" value="" class="text_input" autocomplete="off" /></p>
<p><label for="custom_City" class="over">City:</label>
<input name="custom_City" type="text" id="custom_City" value="" class="text_input" autocomplete="off" /></p>
<p><label class="hidden">Select State</label>
<select name="custom_State" id="custom_State" class="select_input">
<option value="">Select State</option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="WY">Wyoming</option>
</select></p>
<p><label for="custom_ZipCode" class="over">Zip code:</label>
<input name="custom_ZipCode" type="text" id="custom_ZipCode" class="text_input required" value="" maxlength="5" autocomplete="off" /></p>
<p><label class="hidden">Birth Month</label>
<select name="custom_DOBMonth" id="custom_DOBMonth" class="select_input select_month">
<option value="">Birth Month</option>
<option value="01">January</option>
<option value="02">Febuary</option>
</select>
<label class="hidden">Birth Day</label>
<select name="custom_DOBDay" id="custom_DOBDay" class="select_input select_day">
<option value="">Day</option>
<?php for($dy=1; $dy<32; $dy++){
$sdy = $dy < 10? '0'.$dy: $dy;
echo '<option value="'.$sdy.'">'.$dy.'</option>';
} ?>
</select>
<label class="hidden">Birth Year</label>
<select name="custom_DOB_Year" id="custom_DOB_Year" class="select_input select_year">
<option value="">Year</option>
<?php for($yr=2000; $yr>1910; $yr--){
echo '<option value="'.$yr.'">'.$yr.'</option>';
} ?>
</select></p>
<p><label class="hidden">Select Gender</label>
<select name="custom_Gender" id="custom_Gender" class="select_input">
<option value="">Select Gender</option>
<option value="M">Male</option>
<option value="F">Female</option>
</select></p>
<p><label for="custom_Phone" class="over">Phone: (xxx-xxx-xxxx)</label>
<input type="text" name="custom_Phone" id="custom_Phone" class="text_input" value="" /></p>
<span id="optinsection">
<br />
<input type="checkbox" name="chk_allinbox" id="chk_allinbox" class="required" value="1" />
By checking this box, you agree to our Terms of Service and Privacy Policy and agree to receive daily newsletters and promotions via email from BestHotSurveys.com.
<br /><br />
</div>
<div class="form_button">
<input type="submit" class="submit" onclick="javascript: return TMG_CheckForClick(); ShowExitPopup=false;" />
</div>
</form>
<?php /*** Form ends here ***/ ?>

From the site you provided after submit button is clicked the submit button wrapper div form_button is stylized by a background-image style.
Before Button Click :
<div class="form_button">
<input type="submit" class="submit" onclick="javascript: return TMG_CheckForClick(); ShowExitPopup=false;">
</div>
After button click with validation pass :
<div class="form_button" style="background-image: url(http://www.besthotsurveys.com/images/form_bottom_sending.gif);">
<input type="submit" class="submit" onclick="javascript: return TMG_CheckForClick(); ShowExitPopup=false;" disabled="disabled">
</div>
So look onto your TMG_CheckForClick for removing that style or check the availability of that image.
Currently for the image access it throws
The requested URL /images/form_bottom_sending.gif was not found on
this server.

Related

automatically add form input field based on input value

can someone help me please ?
i have a hidden input field with value. for example 3.
based on that value (3) i want to automatically generate 3 input fields like this.
<html>
<head>
</head>
<body>
<form action="#">
<input type="text" name="guest" value="3" hidden>
<div id="container">
<!-- input field 1 -->
<label for="title">Title</label>
<select name="title" class="form-control">
<option value="">Select</option>
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
</select><br>
<label for="first name">First Name</label>
<input type="text" name="first_name" class="form-control"><br>
<label for="last name">Last Name</label>
<input type="text" name="last_name" class="form-control">
<br>
<br>
<!-- input field 2 -->
<label for="title">Title</label>
<select name="title" class="form-control">
<option value="">Select</option>
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
</select><br>
<label for="first name">First Name</label>
<input type="text" name="first_name" class="form-control"><br>
<label for="last name">Last Name</label>
<input type="text" name="last_name" class="form-control">
<br>
<br>
<!-- input field 3 -->
<label for="title">Title</label>
<select name="title" class="form-control">
<option value="">Select</option>
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
</select><br>
<label for="first name">First Name</label>
<input type="text" name="first_name" class="form-control"><br>
<label for="last name">Last Name</label>
<input type="text" name="last_name" class="form-control">
</div>
</form>
</body>
</html>
i have try the dynamic input with button, but in my case i don't want to use a button to add a new input fields.

How to get a success message after form submission in codeigniter

I am doing a form in codeigniter . This is my code:
<?php echo form_open_multipart(''); ?>
<div class="input-group">
<input maxlength="30" type="text" name="name" placeholder="Name" class="form-control" required>
</div>
<div class="input-group">
<select onchange="getcountrycode(this)" name="country" placeholder="Country" class="form-control" required>
<option value="">Select Country</option>
<option value="+971" class="form-control">UAE</option>
<option value="+968" class="form-control">OMAN</option>
<option value="+974" class="form-control">QATAR</option>
<option value="+91" class="form-control">IND</option>
<option value="+966" class="form-control">KSA</option>
</select>
</div>
<div class="input-group" style="display: flex;">
<input style="width: 27%;text-align: left;padding: 15px;border-right: 0px;" type="tel" id="code" name="code"
placeholder="*Code" class="form-control" readonly>
<input style="width: 63%;" type="tel" name="mobile" placeholder="Mobile No" class="form-control" required>
</div>
<div class="input-group">
<input type="email" name="email" placeholder="Email" class="form-control" required>
</div>
<div class="input-group">
<select name="myselect" placeholder="Type" class="form-control" required>
<option value="">Select Type</option>
<option value="Product" class="form-control">Product</option>
<option value="Order" class="form-control">Order</option>
<option value="Complaint" class="form-control">Complaint</option>
<option value="Return" class="form-control">Return</option>
<option value="Refund" class="form-control">Refund</option>
<option value="Other" class="form-control">Other</option>
</select>
</div>
<div class="input-group">
<textarea maxlength="200" name="message" placeholder="Message" class="form-control" required></textarea>
</div>
<center><button type="submit" id="submit" name="submit" value="Submit" class="submit">Submit</button></center>
<br>
</form>
I want a success message to pop up after the form is submitted with all the required fields. Can someone please help me ?
Try this
Controller file
Success Message :
$this->session->set_flashdata("success","New User Register Successfull..!");
redirect("user","refresh");
Error Message
$this->session->set_flashdata('error','Rong User Details');
redirect("user","refresh");
View file
<?php
if ($this->session->flashdata('success')) { ?>
<div class="alert alert-success">
<?php echo $this->session->flashdata('success'); ?>
</div>
<?php
?>
<?php
if ($this->session->flashdata('error')) { ?>
<div class="alert alert-danger">
<?php echo $this->session->flashdata('error'); ?>
</div>
<?php
?>

radio button to show different form depending on a choice inside a form

I don't know if i missed some small error or what but can't get it to work.
I have a form which will send data to email_to_us.php. Inside the form I have two radio buttons. They are inside this form becouse this is a mandatory data which is also send to us. Now I want to change a form depending on what a user chooses. So far I have this:
HTML:
<form action="email_to_us.php" method="post">
<span class="link_title">Prijavljam se na tečaj:</span><br><br>
<select name="prijava_na_datum" required>
<option value="" selected="selected">Izberi datum</option>;
<?php
$con = mysqli_connect('localhost','root','','viverius_education');
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
$sql = mysqli_query($con, "SELECT ID_TECAJA, DATUM FROM razpisani_tecaji WHERE STATUS ='odprt' AND ST_ODPRTIH_MEST>0");
while ($row = $sql->fetch_assoc()){
echo "<option value='" . $row['ID_TECAJA'] . "'>" . $row['DATUM'] . "</option>";
}
?>
</select>
<br>
<input type="radio" id="radio1" name="status_osebe" value="fizicna" required> Fizična oseba
<input type="radio" id="radio2" name="status_osebe" value="pravna"> Pravna oseba<br><br>
<form method ="post" id="fizicna_oseba">
<input class="span7" type="text" name="ime" value="" placeholder="Ime" required/>
<input class="span7" type="text" name="priimek" value="" placeholder="Priimek" required />
<input class="span7" type="email" name="email" value="" placeholder="Email" required/>
<input class="span7" type="text" name="telefon" value="" placeholder="Telefonska številka (podatek ni obvezen)"/><br>
Vaša izobrazba/status<br>
<select name="izobrazba" required>
<option></option>
<option value="student">Študent</option>
<option value="pripravnik">Pripravnik</option>
<option value="specializant">Specializant</option>
<option value="specialist">Specialist</option>
</select>
<input class="span7" type="text" name="kraj" value="" placeholder="Ustanova/kraj (podatek ni obvezen)"/><br>
</form>
<form method ="post" id="podjetje">
<input class="span7" type="text" name="ime" value="" placeholder="Ime" required/>
<input class="span7" type="text" name="priimek" value="" placeholder="Priimek" required />
<input class="span7" type="email" name="email" value="" placeholder="Email" required/>
<input class="span7" type="text" name="telefon" value="" placeholder="Telefonska številka (podatek ni obvezen)"/><br>
Izberite koliko oseb želite prijaviti na tečaj? Odprla se vam bodo dodatna okna kjer prosimo, da izpolnete podatke o udeležencih.<br>
<input type="radio" id="radio01" name="st_oseb" value="fizicna" required>1
<input type="radio" id="radio02" name="st_oseb" value="pravna">2
<input type="radio" id="radio03" name="st_oseb" value="fizicna" required>3
<input type="radio" id="radio04" name="st_oseb" value="pravna">4
<input type="radio" id="radio05" name="st_oseb" value="pravna">5<br><br>
Vaša izobrazba/status<br>
<select name="izobrazba" required>
<option></option>
<option value="student">Študent</option>
<option value="pripravnik">Pripravnik</option>
<option value="specializant">Specializant</option>
<option value="specialist">Specialist</option>
</select>
<input class="span7" type="text" name="kraj" value="" placeholder="Ustanova/kraj (podatek ni obvezen)"/><br>
</form>
<input type="checkbox" name="register" value="register"> Ob prijavi me tudi registriraj!
Kaj pridobim z registracijo?<br><br>
<input type="submit" class="btn send_btn" value="Pošlji" />
<div class="clear"></div><br>
</form>
JavaSript:
<script type="text/javascript">
$('#radio1').change(function() {
if(this.checked) {
$('#fizicna_oseba').show();
$('#podjetje').hide();
}
});
$('#radio2').change(function() {
if(this.checked) {
$('#podjetje').show();
$('#fizicna_oseba').hide();
}
});
</script>
A simpler and cleaner way would be to use with class name
<input ... class="rButton">
<input ... class="rButton">
Script
​$( ".rButton" ).change(function() {
switch($(this).val()) {
case 'fizician_ca' :
// do something on this value
break;
case 'etc' :
// do something with this value
break;
}
});​

JQuery Datepicker and PHP input parsing

I'm trying to figure out how to pass dates chosen by a user with the JQuery datepicker at my index.htlm form to the book.php form, and I believe there is a problem. So the code I use is:
index.html:
<form id="check-book" name="check-book" method="post" action="/book.php">
<fieldset>
<label for="field_date_in">Дата заезда:</label>
<input type="text" id="field_date_in" size="8" readonly="readonly" name="sender_checkin"/>
<label for="field_date_out">Дата выезда:</label>
<input type="text" id="field_date_out" size="8" readonly="readonly" name="sender_checkout"/>
<input type="submit" name="send_message" value="Забронировать!">
</fieldset>
</form>
book.php:
<?php
$field_date_in = $_REQUEST['sender_checkin'];
$field_date_out = $_REQUEST['sender_checkout'];
?>
<!doctype html>
<html>
. . .
<form id="booking-form" name="contact-form" action="send-mail.php" method="POST">
<fieldset>
<legend>Контактная Информация</legend>
<label for="field_name">Имя:</label>
<input type="text" id="field_name" name="sender_name" placeholder="Введите Ваше Имя" autofocus/>
<label for="field_email">E-mail:</label>
<input type="text" id="field_email" pattern="[a-zA-Z]{3,}#[a-zA-Z]{3,}[.]{1}[a-zA-Z]{2,}" title="Пожалуйста введите e-mail" name="sender_email" placeholder="Введите Ваш e-mail">
<label for="field_phone">Номер телефона:</label>
<input type="text" id="field_phone" name="sender_phone" placeholder="Введите Ваш Номер Телефона" >
</fieldset>
<fieldset>
<legend>Информаци о бронировании</legend>
<label for="room_selector">Выберите номер:</label><select name="room_selector" id="room_selector">
<option value="eco_twin">Эконом (Две кровати)</option>
<option value="std_twin">Стандарт (Две кровати)</option>
<option value="std_double">Стандарт (Двойная кровать)</option>
<option value="attic_twin">Эконом Мансарда (Две кровати)</option>
<option value="attic_double">Эконом Мансарда (Двойная кровать)</option>
<option value="lux_twin">Люкс (Две кровати)</option>
<option value="lux_double">Люкс (Двойная кровать)</option>
<option value="lux_wed">Люкс Свадебный</option>
<option value="lux_lux">Суперлюкс</option>
</select>
<label for="field_date_in">Дата заезда:</label>
<input type="text" id="field_date_in" size="8" readonly="readonly" name="sender_checkin" value="<?php echo ($field_check_in);?>"/>
<label for="field_date_out">Дата выезда:</label>
<input type="text" id="field_date_out" size="8" readonly="readonly" name="sender_checkout" value="<?php echo $field_check_out;?>"/>
<label for="field_guests">Количество гостей:</label>
<input type="number" step="1" value="1" min="1" max="100" id="field_guests" name="sender_guests" />
<label for="field_message">Сообщение:</label>
<textarea id="field_message" name="sender_message" rows="5" cols="50"></textarea><br>
</fieldset>
<fieldset>
<input type="submit" name="send_message" value="Отправить">
</fieldset>
</form>
However, once I choose the dates at index.html and press submit, book.php does not have the dates, the input areas are empty. I believe that might be due to the fact that Datepicker re-writes
value class = "hasDatepicker"
so that value that is given by php does not apply any longer. How do I fix it?

How to clear user selected values with a reset button

I need help with a reset button that will clear all the values selected or entered by the user. My code example is below. I have used JS before to reset all the values from a form but in this case i only need to clear a section of the form. My code is below: So each Fieldset has either text box or drop down.
<div class="column">
<p class="label item-information-fields">New Item</p>
<div class="item-information-fields">
<fieldset class="input-section">
<label for="tItemNickname"><span class="required">*</span>Item Name</label>
<input type="text" class="input" name="tItemNickname" id="tItemNickname" maxlength="15" />
</fieldset>
<fieldset class="input-section">
<label for="sItemType"><span class="required">*</span>Item Type</label>
<select name="sItemType" id="sItemType">
<option value="">Select</option>
<option value="1">Cash/Certificate</option>
<option value="2">Jewelry</option>
<option value="3">Clothing/Home Products</option>
<option value="4">Arts/Crafts</option>
<option value="5">Media, Music/Video</option>
<option value="6">Electronics</option>
<option value="7">Computers</option>
<option value="8">Collectibles</option>
<option value="9">Sports Equipment</option>
<option value="10">Liquor/Wine</option>
<option value="11">Animals</option>
<option value="12">Document Reconstruction</option>
<option value="13">Firearm</option>
<option value="14">Hazardous Material</option>
<option value="16">Event Tickets</option>
<option value="15">Other</option>
</select>
</fieldset>
<fieldset class="input-section hide" id="otherItemType">
<label for="tOtherItem"><span class="required">*</span>Other Item Type</label>
<input type="text" class="input" name="tOtherItem" id="tOtherItem" maxlength="15" />
</fieldset>
<fieldset class="input-section">
<label for="tItemDescription"><span class="required">*</span>Item Description</label>
<textarea class="textarea counter" name="tItemDescription" id="tItemDescription" maxlength="120"></textarea>
</fieldset>
<fieldset class="input-section input-section-short">
<label for="tPurchaseDate"><span class="required">*</span>Purchase Date (mm/dd/yyyy)</label>
<input class="input hasDatePicker enable-sundays" name="tPurchaseDate" id="tPurchaseDate" type="text" />
</fieldset>
<p class="note">If there was no purchase date, use the date the item was shipped.</p>
<fieldset class="input-section borders">
<label for="tAmountRequested"><span class="required">*</span>Amount Requested</label>
<span class="dollarWrap">
<span class="input-dollar-sign">$</span>
<input class="input" name="tAmountRequested" id="tAmountRequested" type="text" />
</span>
</fieldset>
// Button to clear the form.
<input type="reset" value="Reset" />
Or something like this:
$(function(){
$("#ClearItems").click(function(){
$("#myForm")[0].reset();
});
});
Working fiddle: http://jsfiddle.net/oqcqwyy4/

Categories

Resources