jQuery Mobile dialog with form: after submitting $_POST is empty - forms

I have a problem reading the $_POST data after i submitted a form from a dialog.
The setup is like this:
Page1 (clientcard.php) contains a link to a dialog:
Add new contact...
Page 2 (the addcontact.php) posts the data to clientcard.php:
<h3 style="margin-top: 0px;">Create contact</h3>
<form method="POST" name="formaddcontact" id="formaddcontact" action="clientcard.php">
<input type="hidden" name="client_ref" value="<?php echo $id;?>" />
<input type="hidden" name="mode" value="addcontact" />
<ul data-role="listview" data-inset="true">
<li class="ui-field-contain">
<label for="naam">name:</label>
<input name="naam" id="naam" value="" data-clear-btn="false" type="text" />
</li>
<li class="ui-field-contain">
<label for="functie_ref">Department:</label>
<select name="functie_ref" id="functie_ref" data-native-menu="false">
<!-- some options -->
</select>
</li>
<li class="ui-field-contain">
<label for="telefoon">Phone:</label>
<input name="telefoon" id="telefoon" value="" data-clear-btn="false" type="text" />
</li>
<li class="ui-field-contain">
<label for="mobiel">Cell:</label>
<input name="mobiel" id="mobiel" value="" data-clear-btn="false" type="text" />
</li>
<li class="ui-field-contain">
<label for="email">Email:</label>
<input name="email" id="email" value="" data-clear-btn="false" type="text" />
</li>
<li class="ui-body ui-body-b">
<fieldset class="ui-grid-a">
<div class="ui-block-a">Annuleren</div>
<div class="ui-block-b">Opslaan</div>
</fieldset>
</li>
</ul>
</form>
I read in other answers that you have to use something like parent().appendTo($("form:first"));but to be honest i have NO clue where to put that...
I use jquery mobile 1.4.3 and the jquery code that is actually popping up the dialog is generated by jqm and i have no <script> code whatsoever in my files...
Any help would be greatly appreciated.
Regards, Christiaan

Related

ASP.NET Core and Bootstrap : how to put dropdown inside form group?

I'm using <label asp-for and <input asp-for tags inside my form to carry out "Create Form" action as well as Bootstrap for looks. How do I fix this bug, it's working with asp-for, I can create and edit successfully through these fields but its looks rather twisted than user friendly.
<div class="form-group">
<label asp-for="City" class="control-label"></label>
<input asp-for="City" class="form-control" />
<span asp-validation-for="City" class="text-danger"></span>
</div>
<div class="input-group">
<input type="text" class="form-control" aria-label="Text input with dropdown button">
<div class="input-group-append">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown</button>
<div class="dropdown-menu">
<label asp-for="Department" class="dropdown-item">HR</label>
<input asp-for="Department" class="form-control" />
<label asp-for="Department" class="dropdown-item">Sales</label>
<input asp-for="Department" class="form-control" />
</div>
<span asp-validation-for="Department" class="text-danger"></span>
</div>
</div>
Here is the result:
Before select
During select
After select
As you can see its not populating inside the text field but its there, I tested it. Maybe there is other way to do it with HTML tags?
Do you want something like this, you can use the <select> tag to implement the dropdown:
<div class="form-group">
<label asp-for="City" class="control-label"></label>
<input asp-for="City" class="form-control" />
<span asp-validation-for="City" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Department" class="control-label"></label>
<select asp-for="Department" class="form-control">
<option selected>Choose Department</option>
<option value="HR">HR</option>
<option value="Sales">Sales</option>
<option value="Other">Other</option>
</select>
</div>
Result:

condition field password (Password Protection)

I created a webform (Registration) Via phpform.org but I want make a condition for a field (Password) Like that (if password field is equal to 'test' then show Submit field )
<li id="li_2" >
<label class="description" for="element_2">Name </label>
<span>
<input id="element_2_1" name= "element_2_1" class="element text" maxlength="255" size="8" value=""/>
<label>First</label>
</span>
<span>
<input id="element_2_2" name= "element_2_2" class="element text" maxlength="255" size="14" value=""/>
<label>Last</label>
</span>
</li> <li id="li_1" >
<label class="description" for="element_1">Password </label>
<div>
<input id="element_1" name="element_1" class="element text medium" type="text" maxlength="255" value=""/>
</div>
</li>
<li class="buttons">
<input type="hidden" name="form_id" value="677911" />
<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
</li>
</ul>
</form>
<div id="footer">
Generated by pForm
</div>
</div>
<img id="bottom" src="bottom.png" alt="">
</body>
Please how can I do that ?
You may use jQuery:
$(".buttons").hide();
$("#element_1").keyup(function () {
if ($(this).val() == "test") {
$(".buttons").show();
} else {
$(".buttons").hide();
}
});
See it working here: http://jsfiddle.net/7UtHW/.

I cant get my mailto contact form to work

I have tried to make a contact form in a modal window. I thought I had done everything correctly but when I click send, I don't receive the email. Can anybody please show me where I'm going wrong?
Thanks very much in advance. Merry Xmas!
<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Contact McGregor Beauty</h3>
</div>
<div class="modal-body">
<form id="contact" method="post" action="mailto:aka_pipsqueak#msn.com">
Your Name <input class="input-xlarge" type="text" placeholder="Please write your name here" required>
<br />
Your Email <input class="input-xlarge" type="email" placeholder="Please enter your email address here" required><br />
Phone(Optional) <input class="input-large" type="number" placeholder="Add a telephone number"><hr />
<label><strong>Treatments of Interest</strong></label>
<label class="checkbox">
<input type="checkbox" value="Waxing & Tinting">Waxing & Tinting
</label>
<label class="checkbox">
<input type="checkbox" value="Massage">Massage
</label>
<label class="checkbox">
<input type="checkbox" value="Reflexology">Reflexology
</label>
<label class="checkbox">
<input type="checkbox" value="Manicure/Pedicure">Manicure & Pedicure
</label>
<label class="checkbox">
<input type="checkbox" value="MLD">MLD
</label>
<br />
<label><strong>Your Questions/Comments</strong></label>
<textarea rows="2" style="width:500px" type="text" required></textarea>
<div class="modal-footer">
<button class="btn btn-primary" type="submit" data-dismiss="modal" aria-hidden="true">Send</button>
</div>
</form>
what mail server are you using?
where is the server side code used to handle the http request of the form?
Just having a form in html isn't going to do anything, and an action of mailto: is not correct, nor would you want to do this because this email address can be seen in the markup and will be spammed until you close it.
what programming language are you planning to use?
Here's a basic example you can follow using php:
http://www.w3schools.com/php/php_mail.asp

HTML form not sending parameters

I wrote a login panel for my website and everything looks fine but when I click on submit page refreshes and no parameters are being sent. I checked both get andpost methods but it's not working. here is my code:
<form id="login_form" action="index.php?task=login" method="post">
<div class="control-group">
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-user"></i></span>
<input class="span2" id="username" type="text" value="Username" onblur="if(this.value=='') this.value='Username'" onfocus="if(this.value=='Username') this.value='';">
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-cog"></i></span>
<input class="span2" id="password" type="password" value="Password" onblur="if(this.value=='') this.value='Password'" onfocus="if(this.value=='Password') this.value='';" />
</div>
</div>
</div>
<div class="clear"></div>
<div class="separator"></div>
<button type="submit" class="btn">Login</button>
</form>
Can anyone tell me what is wrong with my code?
Your input tags don't have the name attribute which is required to post the value.
<input type="text" name="username" />

Need to change smarty file into zend file

HI here i have smarty file and i need to convert into zend..
How can i change smarty to zend? its tpl file
<div id="add-user-form" class="form">
<form action="/account/login" method="post">
{{input_text type="hidden" name="redirect_url" value=$smarty.server.REDIRECT_URL|default:"/"}}
<div class="contain">
<div class="fieldgrp">
<label> </label>
<div class="field"><p><h3>Enter User Credentials</h3></p></div>
</div>
<div class="fieldgrp">
<label for="login_name">Username </label>
<div class="field">{{input_text name="login" id="login_name" class="longfield" maxlength="100"}}</div>
</div>
<div class="fieldgrp">
<label for="login_password">Password </label>
<div class="field">{{input_text type="password" name="password" id="login_password" class="longfield" maxlength="100"}}</div>
</div>
<div class="fieldgrp">
<label> </label>
<div class="field"><input type="submit" value="Login" /></div>
</div>
</div>
</form>
You can replace the Smarty code with the HTML it generates....
eg.
{{input_text name="login" id="login_name" class="longfield" maxlength="100"}}
becomes
<input type="text" name="login" id="login_name" class="longfield" maxlength="100">
But past that, this question doesn't really make a lot of sense.