mardi 31 mars 2015

Can I nest an element inside a form's select tag?

I'm looking to add a colour swatch next to a bunch of colour options, ie...


Markup:



<select class="form-control required" name="stripe-form-color">
<option>Pacific Blue <span class="blue"></span></option> </select>


CSS:



form select span {
margin-left: 10px;
height: 10px;
width: 10px;
border: 1px solid #000;
}

form .blue {
background: #27a9d4;
}


When I try this, and check the source, the span isn't showing up in the select element.


Any help is much appreciated, thanks!


Need SMTP authentication in my PHP form?

i have created a form and it doesnt send out emails. I contacted my host and he said I need SMTP authentication. Form needs to send reservation info.


Here is my reservation.php file:





<script>
/////////////////// RESERVATION FORM //////////////////////
$("#ajax-contact-form").submit(function(){
var str = $(this).serialize();
document.getElementById('submit').disabled=true;
document.getElementById('submit').value='PLEASE WAIT';
$.ajax({
type: "POST",
url: "apartments_reservation_send.php",
data: str,
success: function(msg){
$("#note").ajaxComplete(function(event, request, settings){
if(msg == 'OK')
{
result = '<div class="notification_ok">Thank you!<br />Your request is successfully sent!</div>';
$("#fields").hide();
}
else
{
document.getElementById('submit').disabled=false;
document.getElementById('submit').value='Send request';
result = msg;
autoReinitialise: true;
}
$(this).html(result);
});
}
});
return false;
});
</script>

<form id="ajax-contact-form" action="javascript:alert('success!');">
<table width="100%" cellpadding="3" cellspacing="3">
<tr>
<td width="50%" align="right" style="text-align: right;">
Arrival Date<span class="REQ">*</span> &rarr; <input id="arrivalDate" name="arrivalDate" size="30" type="text" class="date-pick" />
</td>
<td width="50%" align="left" style="text-align: left;">
<input id="departureDate" name="departureDate" size="30" type="text" class="date-pick" />
&larr; <span class="REQ">*</span>Departure Date
</td>
</tr>
<tr>
<td width="50%" align="right" style="text-align: right;">
Adults<span class="REQ">*</span> &rarr;
<select id="Adults" name="Adults">
<option value=""></option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</td>
<td width="50%" align="left" style="text-align: left;">
<select id="Children" name="Children">
<option value=""></option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
&larr; <span class="REQ">*</span>Children
</td>
</tr>
</table>
<table width="100%" cellpadding="3" cellspacing="3">
<tr>
<td width="25%" align="right" valign="middle" style="text-align: right;">Name<span class="REQ">*</span> :</td>
<td width="75%" align="left" style="text-align: left;">
<input type="text" id="name" name="name" value="" size="86" />
</td>
</tr>
<tr>
<td align="right" valign="middle" style="text-align: right;">E-mail<span class="REQ">*</span> :</td>
<td align="left" style="text-align: left;">
<input type="text" id="email" name="email" value="" size="86" />
</td>
</tr>
<tr>
<td align="right" valign="middle" style="text-align: right;">Phone<span class="REQ">*</span> :</td>
<td align="left" style="text-align: left;">
<input type="text" id="phone" name="phone" value="" size="86" />
</td>
</tr>
<tr>
<td align="right" style="text-align: right;">Message :</td>
<td align="left" valign="top" style="text-align: left;">
<textarea id="message" name="message" rows="5" cols="87"></textarea>
</td>
</tr>
<tr>
<td width="100%" align="center" style="text-align: center;" colspan="2">
<input class="button" type="submit" name="submit" id="submit" value="Send request" />
</td>
</tr>
</table>
</form>



and here is my reservarion_send.php:





<?php

$TO_EMAIL = "info@thebunchofgrapesinn.com";
$FROM_EMAIL = "info@thebunchofgrapesinn.com";
$FROM_NAME = "thebunchofgrapes.com";
$SUBJECT = "The Bunch Og Grapes - Apartment Reservation";
error_reporting (E_ALL ^ E_NOTICE);
$post = (!empty($_POST)) ? true : false;

if($post)
{
include 'functions.php';

$ARIVAL_DATE = trim($_POST['arrivalDate']);
$DEPARTURE_DATE = trim($_POST['departureDate']);
$ADULTS = trim($_POST['Adults']);
$CHILDREN = trim($_POST['Children']);
$EMAIL = trim($_POST['email']);
$PHONE = trim($_POST['phone']);
$NAME = stripslashes($_POST['name']);
$MESSAGE = stripslashes($_POST['message']);

$ERROR = '';
if(!$ARIVAL_DATE)
{
$ERROR .= 'Please enter Arrival Date<br />';
}
if(!$DEPARTURE_DATE)
{
$ERROR .= 'Please enter Departure Date<br />';
}
//if(!$ADULTS)
//{
//$ERROR .= 'Please pick number of Adults<br />';
//}
//if(!$CHILDREN)
//{
//$ERROR .= 'Please pick number of Children<br />';
//}
if(!$NAME)
{
$ERROR .= 'Please enter Your Name.<br />';
}
if(!$EMAIL)
{
$ERROR .= 'Please enter Email address.<br />';
}
if($EMAIL && !ValidateEmail($EMAIL))
{
$ERROR .= 'Please enter valid Email address.<br />';
}
if(!$PHONE)
{
$ERROR .= 'Please enter You Phone Number.<br />';
}
//if(!$MESSAGE || strlen($MESSAGE) < 15) {
//$ERROR .= "Molimo unesite poruku. <br />Poruka mora imati najmanje 15 karaktera.<br />";
//}

$FULL_MESSAGE = "ARIVAL DATE = $ARIVAL_DATE\nDEPARTURE DATE = $DEPARTURE_DATE\nADULTS = $ADULTS\nCHILDREN = $CHILDREN\nNAME = $NAME\nEMAIL = $EMAIL\nPHONE = $PHONE\nMESSAGE = $MESSAGE";

if(!$ERROR)
{
$mail = mail($TO_EMAIL, $SUBJECT, $FULL_MESSAGE,
"From: ".$FROM_NAME." <".$FROM_EMAIL.">\r\n"
."Reply-To: ".$FROM_EMAIL."\r\n"
."X-Mailer: PHP/" . phpversion());

if($mail) {
echo 'OK';
}
}
else {
echo '<div class="notification_error">'.$ERROR.'</div>';
}

}
?>



and here is the link of the webpage http://ift.tt/1DkxbTS


I am not sure how to add SMTP authentication and what is wrong here, can someone help?


Typo3 powermail static form template

Normally in powermail I create a form in the typo3 backend. But is it possible to create a static form? I want to achieve a form that is placed in the footer that the user cannot edit.


Form validation for rich text field in Visualforce page

I am using Parsley, a javascript plugin, for form validation in my app. Validation rule is firing for input text and checkbox fields but it is not firing for rich text area. I have specified data-parsley-required="true". Is there anything else I have to specify for rich text area field validation.


How to prevent browsers from retrying failed POST requests (and check for internet connectivity)?

I have a site intended for mobile users that would check the connectivity for every POST requests. If there is no internet connectivity, I will prompt our an error message for to user. Also, I would like to have a transition effect indicating the form is being submitted. I have the following codes



var progress = 0;

$('div').on('submit', 'form', function(e){

var thisform = this;

if(progress === 1){

// check internet connection
var connection = hostReachable();

if(!connection){
alert('No connection');
setTimeout(function(){ // re-allow submission after 8000 ms (not immediately to avoid browser retry)
progress = 0;
},8000);
return false;
}

return true;
}

e.preventDefault();
e.stopPropagation();

if(progress === 0){ // first submit

// updated progress value
progress = 1;

//form transition
$('.spinner').show('fast', function(){
$('.pagecontent').fadeOut('fast');
thisform.submit();
});

} else {
// prevent submit retries when no connectivity
return false;
}
});


where hostReachable() is a function for checking connectivity using xhr request.


The problem is now after the thisform.submit(); the form submission event seems not triggered again. So the codes inside if(progress === 1) is never run. Why is it so? What's wrong with my codes? Thanks!


Prevent user hitting Enter except Textarea

I have a fairly complex form which has multiple stages with many different text fields and text areas. The environment it is used within used barcodes which hit enter by default, and that is by choice as they scan a multitude of products using them so turning the enter function off has become a no-go.


I am using a form wizard script which handles client-side validation during the input stage. This script is interrupted by the enter key being hit during filling out the form and refuses to submit until the page is refreshed.



<a href="javascript:;" class="btn green button-submit">Submit <i class="m-icon-swapright m-icon-white"></i></a>


I have the following code which works to prevent enter on the form and allows the form to submit when the link above is clicked.



$(window).keydown(function(event){
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});


However this prevents enter being used within textarea, as such I did a bit of research and tried using the is() operator from jQuery



$(document).ready(function() {
$(window).keydown(function(event){
if(event.keyCode == 13 && !event.is("textarea")) {
event.preventDefault();
return false;
}
});
});


This doesn't work, it fails to prevent the enter key in inputs and stalls the form from submitting as it did prior.


Finally this is the javascript that handles submitting the form if validation passes on the form



$('#form_wizard_1 .button-submit').click(function () {
// Can put more onsubmit processing here
document.getElementById('submit_form').submit();
}).hide();




Can anyone suggest how I can prevent the enter key on all inputs EXCEPT for textareas. I don't pretend to be a JavaScript developer, although I am trying to learn as I go. The following are articles I have read and either attempted to adapt code or failed to understand how it would apply to me in the correct manner;


Prevent Users from submitting form by hitting enter


Prevent Users from submitting form by hitting enter #2


disable enter key on page, but NOT in textarea




*In regards to the last link, I need a global resolution that automatically prevents it on all textareas that may exist within the form.


As always, thank you for your assistance.


How to get NULL as an option in a datagrid relation in sonata admin bundle?

I added the following to a Sonata admin in order to filter by category. However, the list does not show NULL as an option for category. I want also want to be able to filter by category for when category is NULL instead of an entity.


How can one achieve this? My current configuration:



protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add("category");
}

Concrete5 - Class method not working

I am trying to create a custom dashboard application in Concrete5 for a client of mine. I am having trouble getting methods inside the controller class for the page to work.


You can view my post on the official concrete5 forums for a completely in-depth explanation here: http://ift.tt/1DmvwPh


This is my view.php file for the dashboard page which generates the form



<?php defined('C5_EXECUTE') or die(_("Access Denied."));

$dh = Loader::helper('concrete/dashboard');
$ih = Loader::helper('concrete/interface');

$uNamePosted = "Pants";

$help = 'This add-on works in conjuction with my XML Export add-on ';
$help .= 'this is a new dashboard page which allows you to open these';
$help .= 'XML files, edit and then save them, so that you can then';
$help .= 'import them using Core Commerce Import.';

echo $dh->getDashboardPaneHeaderWrapper(t('XML Viewer'), t($help), 'span8', false);

?>
<div class="ccm-pane-body">
<?php echo $uNamePosted; ?>
<form method="post"
action="<?php echo $this->action('test_form'); ?>">
<input type="text" name="uName" value="" />
<input type="submit" value="Search" />
</form>
</div>
<?php echo $dh->getDashboardPaneFooterWrapper(false); ?>


This is the contents of my controller.php file for the dashboard page



<?php defined('C5_EXECUTE') or die(_("Access Denied."));



class DashboardCoreCommerceXmlViewerController extends Controller {
public function test_form() {
$uName = $this->post('uName');
$this->set('uNamePosted', $uName);
}
}


Expected functionality: I type something in the box and push search, the dummy value of 'pants' is changed to what I typed


What is happening: Nothing, when I hit the search button the page reloads and no information is changed.


I am following a tutorial by a C5 staff member located here: http://ift.tt/1CqEkjl


As far as I can tell this should work but nothing happens when I hit search. I have verified that the function inside the class is being accessed because a print("sometext"); at the top of function creates the following error: Cannot modify header information - headers already sent by (output started at public_html/site/packages/xml_viewer/controllers/dashboard/core_commerce/xml_viewer/controller.php:6) in public_html/site/concrete/core/libraries/view.php on line 963


Which is expected because its printing after headers have been sent, but it does prove that concrete5/.PHP is finding the function however nothing happens with the line



$this->set('uNamePosted', $uName);


Any help is appreciated, thanks in advance. Even the tutorial from their own staff member says this should be working.


Day of the Year Program

So I have this code that creates a drop down box to select a month, another drop down box to select the day, then a text field to type in a year. My question is what to do next in php to be able to select a certain month, day, and year to where, when i click "calculate," it will display what day of that year it is?


So for example, if i choose January 4 2015, when i click calculate, i want it to display 4 since it is the 4th day of the calendar year. How do I do that?



<form action="calc.php" method="post">
Month: <select name="month">
<option value="january">January</option>
<option value="february">February</option>
<option value="march">March</option>
<option value="april">April</option>
<option value="may">May</option>
<option value="june">June</option>
<option value="july">july</option>
<option value="august">August</option>
<option value="september">September</option>
<option value="october">October</option>
<option value="november">November</option>
<option value="december">December</option>
</select>

Day: <select name="day">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>

<input name="entry" type="text" size="10" placeholder="Year">

<input type="submit" value="Calculate">
</form>

Text field data not passing properly in form POST method

I am working on a digital employment application for my company using HTML and processing with PHP.


The form is defined by:<form method="post" action="./php/post.php" name="empapp"> and the text field is defined by: <input size="13" name="canyoufeelityeah">


My PHP page contains the following lines: `print_r( $_POST); print_r( $_POST["canyoufeelityeah"]);



if (($_POST["canyoufeelityeah"] = ' ') or ($_POST["initials2"] = ' ') or ($_POST["initials3"] = ' ') or ($_POST["initials4"] = ' ') or ($_POST["signature"] = ' '))
{
echo $_POST["canyoufeelityeah"]."|".$_POST["initials2"]."|".$_POST["initials3"]."|".$_POST["initials4"]."|".$_POST["signature"]."|";
echo "You must initial each of the 4 blocks and sign your name at the bottom. <br />You will be redirected to your application in 15 seconds...";
// echo "<script>setTimeout(\"window.history.back()\", 1500)</script>";
}`


The printing of all the $_POST variables shows the variable "canyoufeelityeah" with the value, but this section of code always pulls a blank.


Can anyone help out with this? I have approximately 30 other variables that are being passed, but this one is the only one giving me any problems, and I am not sure why.


Thanks!


Javascript wont validate form

Currently I have a form that has 3 text inputs. When the "submit" button is pressed it calls a javascript function that validates the form and then submits the form. The problem is that the form is still being submitted without valid inputs. If anyone could tell me why this is happening it would be greatly appreciated.



<html>
<head lang="en">
<meta charset="UTF-8">
<title>Goal Input</title>
<link href="AgileGoals.css" rel="stylesheet">
<script type="text/javascript">
function addSubGoal(){
var table = document.getElementById("goalInput");
var row = table.insertRow(table.rows.length);
row.insertCell(0).innerHTML = "Subgoal:";
row.insertCell(1).innerHTML = "<input type='text' name='subgoal'>";
}
function submit(){
var goodInput = true;
var name = document.getElementById("goalName").value;
var length = document.getElementById("goalLength").value;
if(name==""){
goodInput=false;
document.getElementById("nameError").innerHTML = "<em>Must enter a name.</em>";
}
if(length==""){
goodInput=false;
document.getElementById("lengthError").innerHTML = "<em>Must enter a length</em>";
}else if(isNaN(length)){
goodInput=false;
document.getElementById("lengthError").innerHTML = "<em>Must be a number</em>";
}
else if(length%1!=0){
goodInput=false;
document.getElementById("lengthError").innerHTML = "<em>Must be an integer</em>";
}
if(goodInput){
document.getElementById("goalFoarm").submit();
}
};
</script>
</head>
<body>
<form id="goalForm" action="server" method="post">
<table id="goalInput">
<tr>
<td>Goal Name:</td>
<td><input type="text" name="goalName" id="goalName"></td>
<td id="nameError"></td>
</tr>
<tr>
<td>Goal Length(Months):</td>
<td><input type="text" name="goalLength" id="goalLength"></td>
<td id="lengthError"></td>
</tr>
<tr>
<td>Subgoal:</td>
<td><input type="text" name="subgoal"></td>
</tr>
</table>
<input type="button" onclick="addSubGoal()" value="Add Subgoal">
<input type="button" onclick="submit()" value="Submit">
</form>

</body>
</html>

How to create a VS 2008 Windows Forms project programmatically, that can be maintained just like any other project created manually

I have a bunch of control properties (type of control, location, size, etc.) derived as a text file from an old system on a different platform. I thought it would be fairly easy to load these "control descriptions" into a Windows Forms project in VS 2008 and then be able to maintain the new project in VS just as if it had been created manually.


I'm familiar with using VS and C# but it I'm not sure where to start with this.


I searched the web and found a number of articles about creating controls on forms at run time and that is not so hard, given the information I have, but I want the created form to be a permanent part of a Win Forms project, so I need to get what was created at run time into VS, and accessible in the project just as if it had been manually dropped on the designer surface. Is there a way I could create these forms with a program and then "save" them in a form acceptable to VS?


I manually created a windows Form project to try and use as a "template" and identify how VS does it. I have tried to understand the contents and the relationships between the various resource files, but it is a bit too much. There are also warnings that various files are created by VS and should not be amended manually.


I have almost 1000 forms from the old system so the thought of manually having to add each one to VS is pretty non-viable. I could translate the text descriptions into XML if there is a way to feed an XML description of a Form into a VS Forms project...?


Any advice\direction towards this would be greatly appreciated.


How can the bootstrap popup remains after submitting a form?

When clicking on submit button, a popup appears but lasts for few seconds due to the redirection page loading. I have tried to block the submit, and add a button to the popup from which I can submit the form.


But with no success.


Anybody for help ?


Thanks


Is it because $_GET is global or the form submitting to itself or else?

I am trying to understand one simple thing in PHP form handling.I am new to it and I have a sample code:



<form name="frm" method="post" action="">
Item Name:<input type="text" name="itmName" id="itmName"/><br/><br/>
<input type="submit" name="sbmit" value="Add Record"/>
</form>

<?php
if(isset($_GET['m']))
{
echo '<script type="text/javascript">alert("'.$_GET['m'].'");</script>';
}
if(isset($_POST['sbmit']))
{
header("location:1.php?m=10");
}
?>


Irrespective of what data I send to the server, my focus is on the if(isset($_GET['m'])) part of the code. Everytime I submit the form, the 'if' is always evaluated to true and as a result the alert box appears.Is it because $_GET is holding the previous value set by header("location:1.php?m=10"); or is it because the form is submitting to itself or else?Googling didn't provide much help. I need better understanding over this.With Thanks


how to send paypal paypment info ( html form ) to paypal securely?

I am creating a wordpress plugin where I need to add payment feature with paypal . To pay with paypal , generally a html form with required information such as paying amount , currency etc is sent to paypal for pay .


But as the form is in client side so it could be changed any time by browser element inspector.


For an example I need to get 200 USD from user. But if the user change the amount from 200 to 20 USD using element inspector , this will be paid 20 USD.


Though I am informed about paypal IPN . It could be detect if the user is paid the required amount or not using IPN message. But I also need to send user id to detect which user has paid . But if someone change the user id from html form , it will not be detectable using IPN message .


I have sent the form with user id . I can also find out current user id in IPN listener script .


But the problem is here . User is not accessing IPN listener but paypal accessing ipn listener , so as if paypal is not the user , user id will not be retrieved from database . As a result I could not verify which user has paid .


What can I do at this moment ? Should I send the form to paypal from server side using CURL ? or anyhow ?


Working with arrays of Windows form elements

What I have:



label4.Show();
label5.Show();
pictureBox3.Show();
textBox1.Show();
button3.Show();


What I need (example, but doesn't work):



Object[] arr = new Object[] { label4,label5,pictureBox3,textBox1,button3 };
foreach (Object o in arr)
{
o.Show();
}


Is it to possible to do something like this code?


How to submit a form when navigating

I would like to submit a form when navigate the page, which means wherever the page navigate to, the form will be submitted. I tried to use onbeforeunload, but it force me to return an alert to ask if they want to leave the page. I simply do not need that. And also in the controller, I use Play Framework and the action need a redirection to some page, which will break the initial navigation. Is there any way to do it?


FOSUserBundle - how to hold user on homepage after he sent register form?

I render my registration form on homepage using {% render url('fos_user_registration_register') %}. Everything works fine, but when user send this form, Symfony redirect him to default FOSUserBundle registration page and it's my problem, becouse I want to render this form again (with errors or with success message) on my homepage. I completely don't know how to do it! It is possible?


I had the same problem with login form but I used this code in security.yml:



firewalls:
main:
form_login:
login_path: acme__my_homepage
check_path: fos_user_security_check
failure_path: acme__my_homepage


But I can't find above options for registration...


My files:


src\MyBundle\Resources\views\homepage.html.twig



<div class="window">
{% render url('fos_user_registration_register') %}
</div>


app\Resources\FOSUserBundle\views\register.html.twig



<form>
<input class="myCustomFormInput" name="username" />
<input class="myCustomFormInput" name="email" />
<input class="myCustomFormInput" name="password" />
<input class="myCustomFormInput" name="rpassword" />
<button type="submit">Send</button>
</form>

Symfony2 - dynamically added option in choice, form validation showing field value to null

I want to build a form with choice option, which values will add using ajax and it's working like i want but after submitting form symfony2 showing choice option value to null ?


I tried and successfully added dynamically from generation like cookbook shows - http://ift.tt/1bEX27C


but in my current problem, my field in not depend on other option like described in cookbook - sport-position is depend on sport but in my case option is one and without choices initially and then user add options using ajax ..


i tried this and others - Symfony2 - Dynamic form choices - validation remove but these will work when choice is based on other form option, in my case it depend on itself.


my from class code is this - here

'seachText' is text box using for ajax request and then i added selected option to 'college' choice after selection by user but then after submitting form 'POST_SUBMIT' / 'PRE_BIND', i get $event->getForm()->getData()->getCollege() = null :(


college - entity is like symfony2 default declaration with getter and setter

collegeText - public -no db use, just for ajax field


view image - http://ift.tt/1xTgU7S



<?php

namespace MyBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

class SomethingForm extends AbstractType
{
private $container;

public function __construct(ContainerInterface $container){
$this->container = $container;
}

/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{

$builder->add('searchText','text', array(
'label' => 'College',
'required' => false,
)
);

$formModifier = function (FormInterface $form, $college = null) {
$form->add('college', 'choice', array(
'label' => 'College',
'choices' => array(),
'multiple' => true
)
);
};

$builder->addEventListener(
FormEvents::PRE_SET_DATA,
function (FormEvent $event) use ($formModifier) {
// this would be your entity, i.e. getCollege
$data = $event->getData();

$data ? ($data->searchText = $this->container->get('my.service')->getCollegeBasedOnId($data->getCollege())) : '';

$formModifier($event->getForm(), null);
}
);

$builder->addEventListener(
FormEvents::PRE_BIND,
function (FormEvent $event) use ($formModifier) {

//here i am getting null if i added values using ajax
var_dump($event->getForm()->getData());
die();



$college = $event->getForm()->getData();
$formModifier($event->getForm()->getParent(), $college);
}
);
}

/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'MyBundle\Entity\Somthing',
));
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'something';
}
}

add multiple form button scroll bars at once from vba

I need the below macro to reference another sub change event to loop reference to the row number of the scroll bar, i and then adjust the cell Bi . So far I can only get 100 scroll bars to reference only B2



Sub Tester88()
Dim ScrollBar As Object
Dim rng As Range
Dim i As Long
Dim lastRow As Long

lastRow = 99 'Modify as needed this will be the last possible row to add a button

For i = 2 To lastRow Step 4
Set rng = ActiveSheet.Cells(i, 18) 'Column 3, row i

'## Create the button object and assign a variable to represent it
Set ScrollBar = ActiveSheet.ScrollBars.Add(1, 1, 1, 1)

'## use the btn variable to manipulate the button:
With ScrollBar
.Top = rng.Top
.Left = rng.Left
.width = rng.width
.height = rng.RowHeight
.Value = 1
.Min = 1
.Max = 100
.SmallChange = 1
.LargeChange = 10
.LinkedCell = "$B$2"
.Display3DShading = True

End With
Next
End Sub

Css form not working correctly

This is for a non-profit site. Any help would be appreciated!


I created a test page here: http://ift.tt/19xi2SX where you will be able to see the 2 search forms and test them.


This one does not execute the action correctly. It just go to the search page not executing the search itself



<div class="flexsearch">
<div class="flexsearch--wrapper">
<form class="flexsearch--form" action="/full-text-search/index.php" method="get">
<div class="flexsearch--input-wrapper">
<input class="flexsearch--input" type="search" placeholder="search">
</div>
<input class="flexsearch--submit" type="submit" value="&#10140;"/>
</form>
</div>


On the other hand this old one, works perfectly (ugly but working):



<form class="zoom_searchform" action="http://ift.tt/1GcmZNA library/full-text-search/index.php" method="get"><input name="zoom_sort" type="hidden" value="0" />
Search for: <input id="zoom_searchbox" class="zoom_searchbox" name="zoom_query" size="20" type="text" value="" />
<input class="zoom_button" type="submit" value="Submit" />
<span class="zoom_results_per_page"><span class="zoom_results_per_page">Results per page:
<select name="zoom_per_page">
<option selected="selected">10</option>
<option>20</option>
<option>50</option>
<option>100</option>
</select></span></span> </form>


I am sure it is a detail in the coding but, as I am really a novice, I can't figure out what is missing.


Thanks for any help you can provide!


Roger Pilon, Editor The Planet Fixer Digest


Symfony2 multiple Entities of same class in one Form

I want to render a form which has multiple Entities of same Class. I will display 2 fields, Price(type=text) and Enabled(type=checkbox).


I don't know how many I will have of those entities, so form will have to get they dynamically.


I have tried to do the following



public function buildForm(FormBuilderInterface $builder, array $options)
{

$builder
->add('price', 'text', array(
'label' => 'Price',
'required' => true
))
->add('enabled','checkbox',array(
'label' => 'Use this currency',

))
;
}

public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Osiris\Entity\Pricing',
'csrf_protection' => false
));
}

public function getName()
{
return 'pricingtype';
}
}


And in my Controller I create my form as follows:



$pricingForm = $this->createFormBuilder($prices)
->add('items','collection',array(
'required' => false,
'prototype' => true,
'type' => new PricingType(),
))
->getForm()
;


In my twig I do:



{% for price in form_pricing %}
<h2>Price</h2>
<div class="row">{{ form_widget(price) }}</div>
{% endfor %}


However it comes only with h2 Prices and empty div with class=row. I feel like I am half way there, but I've no idea how to move on. If someone knows how to get fields on submit as well, I will really appreciate it.


I have written a page in HTML5 with a special form to accept numeric input only; however, it won't accept decimals

I've written a form (located at http://ift.tt/1IisadK) that uses numeric input, and the PHP script at http://ift.tt/1Iis9Xn will only accept numeric inputs. When I change the number in the URL bar to a decimal, it still works, so I know it's a problem with the form. How do I make it accept decimals?


JSF selectOneMenu ajax doesn't fire listener

The context is a form to add or modify an entry to/of a database table. Inside of it, I want to create a search/selection subform with :



  1. A search text input that request the database to fill a selectOneMenu

  2. The dynamically filled selectOneMenu to select a value

  3. A classic selectOneMenu with values hard-coded


So far I achieved to get the search text input to work only if I am modifying an existing entry (which id is passed via URL). It doesn't work if when I'm creating a new one.


The second problem is (in the case of modifying an entry, which is working already), when a value is chosen in the selectOneMenu, the listener seems to not be called. But with the selectOneMenu that have hard-coded values, it works fine.


Here is the subform code :



<h:form>
<h2>#{msg['addPeopleToFilm']}</h2>
<div class="inputWrapper">
<h:inputText id="search" value="#{beanPersonne.recherche}"
valueChangeListener="#{beanPersonne.searchStringChanged}" >
<f:ajax execute="search" render="output" event="valueChange" />
</h:inputText>
<label>#{msg['personSearch']}</label>
</div>

<div class="selectWrapper" >
<h:selectOneMenu value="#{beanFilm.idToAdd}" id="output" valueChangeListener="#{beanFilm.idToAddChanged}">
<f:selectItem itemLabel="#{msg['researchResults']} ›" itemSelected="true" itemDisabled="true" />
<f:selectItems
value = "#{beanPersonne.resultatsRechercheDynamique}"
var="personne"
itemValue="#{personne.idPersonne}"
itemLabel="#{personne.prenom} #{personne.nom}" />
<f:ajax execute="output" render="idToAdd" event="valueChange" />
</h:selectOneMenu>
</div>

<div class="selectWrapper" >
<h:selectOneMenu value="#{beanFilm.categoryChoice}" id="category" valueChangeListener="#{beanFilm.categoryChoiceChanged}">
<f:selectItem itemLabel="#{msg['type']} ›" itemSelected="true" itemDisabled="#{not empty beanFilm.categoryChoice}" />
<f:selectItem itemLabel="#{msg['actor']} ›" itemValue="0" />
<f:selectItem itemLabel="#{msg['producer']} ›" itemValue="1" />
<f:selectItem itemLabel="#{msg['director']} ›" itemValue="2" />
<f:ajax execute="category" render="categoryChoice" event="valueChange" />
<f:ajax execute="category" render="category" event="valueChange" />
</h:selectOneMenu>
</div>

<h:commandButton value="Test">
</h:commandButton>

<h2><h:outputText id="idToAdd" value="#{beanFilm.idToAdd}" /></h2>
<h2><h:outputText id="categoryChoice" value="#{beanFilm.categoryChoice}" /></h2>
</h:form>


And here is my bean:



public class BeanFilm implements Serializable {

private static final long serialVersionUID = 807253156212218187L;
private Film film = new Film();
private String recherche = new String();
private String idToAdd = new String();
private String categoryChoice = new String();
private List<Film> resultatsRechercheDynamique = new ArrayList<Film>();

public Film getFilm() {
return film;
}

public void setFilm(Film film) {
this.film = film;
}

public int getIdFilm() {
return film.getIdFilm();
}

public void setIdFilm(int id) {
film = DAOFilmJPA.getInstance().get(id);
}

public String getRecherche() {
return recherche;
}

public void setRecherche(String recherche) {
this.recherche = recherche;
}

public String getCheminAffiche() {
File file = new File(FacesContext.getCurrentInstance().getExternalContext().getRealPath("/affiches/" + film.getIdFilm() + ".png"));
if(file.exists())
return "affiches/" + film.getIdFilm() + ".png";

return "images/noimage.png";
}

public String enregistrer() {
DAOFilmJPA.getInstance().save(film);
return "filmSaveComplete";
}

public String doRecherche() {
return "toResultatsRecherche";
}

public List<Film> getResultatsRechercheNotPro() {
return DAOFilmJPA.getInstance().getFilmsParTitre(recherche);
}

public List<Film> getResultatsRechercheFilmPro() {
return DAOFilmJPA.getInstance().getFilmsParTitre(recherche);
}

public List<Personne> getResultatsRecherchePersonnePro() {
return DAOPersonneJPA.getInstance().getPersonnesParNom(recherche);
}

public String searchByTitle(String title)
{
recherche = title;
this.resultatsRechercheDynamique = getResultatsRechercheFilmPro();
return null;
}

public void searchStringChanged(ValueChangeEvent vce)
{
searchByTitle((String) vce.getNewValue());
}

public void idToAddChanged(ValueChangeEvent vce)
{
idToAdd = ((String) vce.getNewValue());
}

public void categoryChoiceChanged(ValueChangeEvent vce)
{
categoryChoice = ((String) vce.getNewValue());
}

public List<Film> getResultatsRechercheDynamique() {
return resultatsRechercheDynamique;
}

public void setResultatsRechercheDynamique(
List<Film> resultatsRechercheDynamique) {
this.resultatsRechercheDynamique = resultatsRechercheDynamique;
}

public String getIdToAdd() {
return idToAdd;
}

public void setIdToAdd(String idToAdd) {
this.idToAdd = idToAdd;
}

public String getCategoryChoice() {
return categoryChoice;
}

public void setCategoryChoice(String categoryChoice) {
this.categoryChoice = categoryChoice;
}
}

Validated optional nested form in Symfony2

Is there a way in Symfony2 to add an optional nested form while using cascade validation? In other words, say I have a user form with a nested address form (->add('adresse', new AddressType(), array('required' => false))). This address is not required BUT must be validated in case the user specify it ('cascade_validation' => true).


UPDATE


Relevant entities and forms :


User entity (Getters & Setters are classical, Symfony generated):



class User
{
[...]

/**
* @var \Address
*
* @ORM\OneToOne(targetEntity="Address", cascade="persist")
* @ORM\JoinColumn(
* name="address_id", referencedColumnName="id"
* )
*/
private $address;

[...]
}


The address entity is classical, no bidirectionnal relation to user.


User form



class UserType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
[...]
->add('address', new AddressType(), array('required' => false))
[...]
;
}

public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Xentia\FuneoBundle\Entity\User',
'cascade_validation' => true
));
}

public function getName()
{
return 'user';
}
}


The address nested form is classical


As you can see, the is a quite classical and straightforward code. The only particular case is that address is optional. Leading to an validation error only in the case that the address was previously set (and, thus, exist in the DB and as a not null relation with the user) and the user want to unset it (all address fields are left empty). It seems that if the related address has not an actual instance it can still be optional. But, if an instance of the address exist and is linked with the user, it can not be optional anymore.


So, what should it do: When the user update his profile, if there was a previously set address and he try to unset it, user->address should be set to NULL and the address should be deleted. What does actually happens: The form throw a validation error saying that the address fields are not set. But, as the address is optional, such validation error should not occur. And, in fact, it does not occur if the address was not set before the user update his profile, it only occurs if there was an address previously set.


HTML contact form with hidden text to display on same page when submit is done

i want a basic html form with name ,email,phone number and comment fields and a submit button on the back end there is mail.php to send mail to the admin i want to write "thank you for your feedback" on the same page but it should be visible only after submit is pressed until then it should be in hidden tag similarly other texts like "enter valid email id" and "field cant be empty" i tried using but it didnt worked anyone can help me in explaining the basics of contact forms give me a basic html code and mail.php to have a good form, explain me the basic that how can i hide something in html and make it appear on any type of command or click etc. provide me a code


Symfony2 - Custom choice [options with custom field]

I am trying to build a form with a choice(radio or checkbox) field, where each options has an input weight(text - in the image the slider is text field)


This is how it should look like.



This is the DB schema.


Updating database table through a textarea

I'm creating a simple website with just two or three pages, and I'm using Froala editor to edit the content directly from the page. So I have a <textarea> within a form with the id of "edit" (To make it a wysiwyg editor) and a submit button. So basically what I want it to do is to UPDATE the "body" column in the table "pages" (where the type = 1) in my database when the button is submitted... Here's the code I have:



<?php

$query = "SELECT * FROM pages WHERE type = 1";
$result = mysqli_query($dbc, $query);

$page = mysqli_fetch_assoc($result);

?>


And the html:



<form>
<textarea id="edit" name="body"><?php echo $page["body"]; ?></textarea>
<button type="submit" class="button button-primary">Save</button>
</form>

Detected form-filling spambot - now what?

Lets say that server-side anti-spam measures have detected a form has been completed/submitted by a spambot - what's the best practice to deal with it?


Display a "thank you" message? (ie trick it into thinking submission was successfully sent - although may attract further spam submissions)


Redirect to homepage (or elsewhere?) or something else?


Forms update output before submit button shiny R

My form automatically updates the output before I press the Submit button. I read the description of "Submit" button and it says "Forms that include a submit button do not automatically update their outputs when inputs change, rather they wait until the user explicitly clicks the submit button". I am not sure if there's anything wrong.


For your information, here is my code. Data is from UCI (adult data)


Server.R



library(shiny)
library(caret)

predictSalary <- function(input){

adultData <- read.table("adult.data", header = FALSE, sep = ",", strip.white = TRUE)
adultName <- read.csv("adult.name.csv", header = FALSE, sep = ",", stringsAsFactors = FALSE)
names(adultData) <- adultName[, 1]

#Only select several attributes
selected <- c("age", "education", "marital.status", "relationship", "sex", "hours.per.week", "salary")
#selected <- c("age", "hours.per.week", "salary")
adultData <- subset(adultData, select = selected)

#The data is big, we only take 20% for the training
trainIndex = createDataPartition(adultData$salary, p=0.20, list=FALSE)
training = adultData[ trainIndex, ]

set.seed(33833)
modFit <- train(salary ~ ., method = "rpart", data=training)
predict(modFit, newdata = input)
}


shinyServer(
function(input, output) {

dataInput <- reactive({

age <- input$age
edu <- as.factor(input$edu)
marritalstat <- input$marritalstat
relationship <- input$relationship
sex <- input$sex
hours <- input$hours
data.frame(age = age,
education = edu,
marital.status = marritalstat,
relationship = relationship,
sex = sex,
hours.per.week = hours)
# age <- input$age
# hours <- input$hours
# data.frame(age = age, hours.per.week = hours)
})

# dat <- c(input$age, input$edu, input$marritalstat,
# input$relationship, input$sex, input$hours)
output$prediction <- renderPrint({predictSalary(dataInput())})
}
)


Ui.R



library(shiny)
shinyUI(
pageWithSidebar(
# Application title
headerPanel("Salary prediction"),
sidebarPanel(
numericInput('age', 'Age', 40, min = 17, max = 90, step = 1),
selectInput('edu', 'Education',
c("Bachelors"="Bachelors",
"Some-college"="Some-college",
"11th"="11th",
"HS-grad"="HS-grad",
"Prof-school"="Prof-school",
"Assoc-acdm"="Assoc-acdm",
"Assoc-voc"="Assoc-voc",
"9th"="9th",
"7th-8th"="7th-8th",
"12th"="12th",
"Masters"="Masters",
"1st-4th"="1st-4th",
"10th"="10th",
"Doctorate"="Doctorate",
"5th-6th"="5th-6th",
"Preschool"="Preschool")),
radioButtons('marritalstat', 'Marrital Status',
c("Married-civ-spouse" = "Married-civ-spouse",
"Divorced" = "Divorced",
"Never-married" = "Never-married",
"Separated" = "Separated",
"Widowed" = "Widowed",
"Married-spouse-absent" = "Married-spouse-absent",
"Married-AF-spouse" = "Married-AF-spouse")),
radioButtons('relationship', 'Relationship',
c("Wife" = "Wife",
"Own-child" = "Own-child",
"Husband" = "Husband",
"Not-in-family" = "Not-in-family",
"Other-relative" = "Other-relative",
"Unmarried" = "Unmarried")),
radioButtons('sex', 'Sex', c("Male", "Female")),
numericInput('hours', 'Hours per week', 40, min = 1, max = 99, step = 1),
submitButton('Submit')
),
mainPanel(
h3('Results of prediction'),
h4('The predicted salary is '),
verbatimTextOutput("prediction"),
h3('Prediction of salary'),
p('The application is designed to predict whether somebodys salary is greater or smaller than 50k.
The data is extracted from the adult data, provided by UCI database. In order to predict a salary, users need to
provide information of the person whom they would like to make prediction on. After filling in necessary information,
users will press "Submit". The information includes:'),
p(' - Age: must be from 17 to 90'),
p(' - Education'),
p(' - Marital status'),
p(' - Relationship'),
p(' - Gender'),
p(' - Total work hours per week: must be from 1 to 99')
)
)
)

Need SMTP authentication in my PHP form?

i have created a form and it doesnt send out emails. I contacted my host and he said I need SMTP authentication. Form needs to send reservation info.


Here is my reservation.php file:





<script>
/////////////////// RESERVATION FORM //////////////////////
$("#ajax-contact-form").submit(function(){
var str = $(this).serialize();
document.getElementById('submit').disabled=true;
document.getElementById('submit').value='PLEASE WAIT';
$.ajax({
type: "POST",
url: "apartments_reservation_send.php",
data: str,
success: function(msg){
$("#note").ajaxComplete(function(event, request, settings){
if(msg == 'OK')
{
result = '<div class="notification_ok">Thank you!<br />Your request is successfully sent!</div>';
$("#fields").hide();
}
else
{
document.getElementById('submit').disabled=false;
document.getElementById('submit').value='Send request';
result = msg;
autoReinitialise: true;
}
$(this).html(result);
});
}
});
return false;
});
</script>

<form id="ajax-contact-form" action="javascript:alert('success!');">
<table width="100%" cellpadding="3" cellspacing="3">
<tr>
<td width="50%" align="right" style="text-align: right;">
Arrival Date<span class="REQ">*</span> &rarr; <input id="arrivalDate" name="arrivalDate" size="30" type="text" class="date-pick" />
</td>
<td width="50%" align="left" style="text-align: left;">
<input id="departureDate" name="departureDate" size="30" type="text" class="date-pick" />
&larr; <span class="REQ">*</span>Departure Date
</td>
</tr>
<tr>
<td width="50%" align="right" style="text-align: right;">
Adults<span class="REQ">*</span> &rarr;
<select id="Adults" name="Adults">
<option value=""></option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</td>
<td width="50%" align="left" style="text-align: left;">
<select id="Children" name="Children">
<option value=""></option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
&larr; <span class="REQ">*</span>Children
</td>
</tr>
</table>
<table width="100%" cellpadding="3" cellspacing="3">
<tr>
<td width="25%" align="right" valign="middle" style="text-align: right;">Name<span class="REQ">*</span> :</td>
<td width="75%" align="left" style="text-align: left;">
<input type="text" id="name" name="name" value="" size="86" />
</td>
</tr>
<tr>
<td align="right" valign="middle" style="text-align: right;">E-mail<span class="REQ">*</span> :</td>
<td align="left" style="text-align: left;">
<input type="text" id="email" name="email" value="" size="86" />
</td>
</tr>
<tr>
<td align="right" valign="middle" style="text-align: right;">Phone<span class="REQ">*</span> :</td>
<td align="left" style="text-align: left;">
<input type="text" id="phone" name="phone" value="" size="86" />
</td>
</tr>
<tr>
<td align="right" style="text-align: right;">Message :</td>
<td align="left" valign="top" style="text-align: left;">
<textarea id="message" name="message" rows="5" cols="87"></textarea>
</td>
</tr>
<tr>
<td width="100%" align="center" style="text-align: center;" colspan="2">
<input class="button" type="submit" name="submit" id="submit" value="Send request" />
</td>
</tr>
</table>
</form>



and here is my reservarion_send.php:





<?php

$TO_EMAIL = "info@thebunchofgrapesinn.com";
$FROM_EMAIL = "info@thebunchofgrapesinn.com";
$FROM_NAME = "thebunchofgrapes.com";
$SUBJECT = "The Bunch Og Grapes - Apartment Reservation";
error_reporting (E_ALL ^ E_NOTICE);
$post = (!empty($_POST)) ? true : false;

if($post)
{
include 'functions.php';

$ARIVAL_DATE = trim($_POST['arrivalDate']);
$DEPARTURE_DATE = trim($_POST['departureDate']);
$ADULTS = trim($_POST['Adults']);
$CHILDREN = trim($_POST['Children']);
$EMAIL = trim($_POST['email']);
$PHONE = trim($_POST['phone']);
$NAME = stripslashes($_POST['name']);
$MESSAGE = stripslashes($_POST['message']);

$ERROR = '';
if(!$ARIVAL_DATE)
{
$ERROR .= 'Please enter Arrival Date<br />';
}
if(!$DEPARTURE_DATE)
{
$ERROR .= 'Please enter Departure Date<br />';
}
//if(!$ADULTS)
//{
//$ERROR .= 'Please pick number of Adults<br />';
//}
//if(!$CHILDREN)
//{
//$ERROR .= 'Please pick number of Children<br />';
//}
if(!$NAME)
{
$ERROR .= 'Please enter Your Name.<br />';
}
if(!$EMAIL)
{
$ERROR .= 'Please enter Email address.<br />';
}
if($EMAIL && !ValidateEmail($EMAIL))
{
$ERROR .= 'Please enter valid Email address.<br />';
}
if(!$PHONE)
{
$ERROR .= 'Please enter You Phone Number.<br />';
}
//if(!$MESSAGE || strlen($MESSAGE) < 15) {
//$ERROR .= "Molimo unesite poruku. <br />Poruka mora imati najmanje 15 karaktera.<br />";
//}

$FULL_MESSAGE = "ARIVAL DATE = $ARIVAL_DATE\nDEPARTURE DATE = $DEPARTURE_DATE\nADULTS = $ADULTS\nCHILDREN = $CHILDREN\nNAME = $NAME\nEMAIL = $EMAIL\nPHONE = $PHONE\nMESSAGE = $MESSAGE";

if(!$ERROR)
{
$mail = mail($TO_EMAIL, $SUBJECT, $FULL_MESSAGE,
"From: ".$FROM_NAME." <".$FROM_EMAIL.">\r\n"
."Reply-To: ".$FROM_EMAIL."\r\n"
."X-Mailer: PHP/" . phpversion());

if($mail) {
echo 'OK';
}
}
else {
echo '<div class="notification_error">'.$ERROR.'</div>';
}

}
?>



and here is the link of the webpage http://ift.tt/1DkxbTS


I am not sure how to add SMTP authentication and what is wrong here, can someone help?


Pass multiple params to the current page with form_tag in Rails

I want to pass several params in the url of the current page with a form_tag but I have failed to understand to correct syntax.



Quick explanation: I have outfits (model) that has many outfit_items (model).

Each outfit_item has available_sizes (attribute of outfit_item). All of this is set by the admin.



Then on the show page of an Outfit, (for example http://localhost:3000/outfits/7) I want to display the available sizes for each outfit_item, let the visitor pick his size for each item and press submit. The selected sizes should then appear in the URL. Here is what I have in my show view, at the url :



<%= form_tag(@outfit_path, :method=>'post') do %>
<% @outfit.outfit_items.each do |outfit_item| %>
<div class="col-md-2 col-sm-6 col-xs-6">
<%= image_tag outfit_item.item_image.url(:medium) %><br>
<% sizes = outfit_item.available_sizes.split(",") %>
<%= select_tag "size#{outfit_item.category}", "<option>#{sizes[1]}</option><option>#{sizes[2]}</option><option>#{sizes[3]}</option><option>#{sizes[4]}</option>".html_safe, :class => "input-mini select-mini" %><br>
<%= hidden_field_tag "size#{outfit_item.category}", value: outfit_item.category %>
</div>
<% end %>
<%= submit_tag "ok size" %>
<% end %>


I want to land on this url when I hit submit



http://localhost:3000/outfits/7?size1=42&size2=L&size3=S&size4=44


Thanks for your help


dynamic display post submission, bypassing validation php javascript

I made a comment system that consists of a single button that opens up a comment panel which modifies the current web page by condensing the article/content to half or 60% of the screen and the comment panel takes up the rest, fixed in place to follow the article as the person scrolls.


Problem is, when I hit the submit/post button, the page refreshes and the comment panel hides again as if it wasn't displayed eg. triggered by the comment panel display button.


So... is this a flawed idea, or can I run the PHP validation part without refreshing the page eg. triggering the display: none; in css?


Submitting search form on website to scrape table

I'm trying to scrape the tables from this website: http://ift.tt/17yLRvY


For example, I want the program to select the radio button for Corporation Name and then submit a corporation name like GOOG in the form. I would like to scrape the data that displays as a result. Can I use the requests library for Python to submit the forms on this page, or do I have to use JavaScript? If so, how can I submit the forms?


How to login by filling a form in a website using Android

I'm trying to log on to a website that has a form to which you should provide user-name and password, check a box, and press a login button. I tried all kinds of httpClient POST messages, but it seems that it is not working. Can anyone assist and point to an example of skeleton of android Java way to login? Here is the form from the html page:



<form name="loginForm" method="post" action="/login.do">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10px">&nbsp;</td>
<td><label class="formLabel" for="loginID">Username</label></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="text" name="username" value="" class="formTextField"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><label class="formLabel" for="password"> Password</label></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="password" name="password" value="" class="formTextField"></td>
</tr>

<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="checkbox" name="agreement" value="on" class="formTextField">

I agree with <div>
<b><a href="javascript:openPopup('ext/ibsContent/terms.pdf')">Terms and Conditions</a></b></div>

</td>
</tr>

</table>
<p><input type="submit" value="Login" class="FPFormFieldB"></p>
<p><a href="navigate.do?anode=user_ChangePassword">Have you forgotten the password?</a></p>
<p><a href="navigate.do?anode=user_Registration">New user registration</a></p>

</form>

Facebook's inApp browser crashes when trying to upload photos in a form

I've got a registration form on a website that requires users to upload photos of themselves. We're sending the link to this form on Facebook, and most of our users open it on mobile, via the inApp web browser of the Facebook App.


I tried to debug the problem with several devices and operating systems:


iOS 7&8: When clicking on the input field, the dialog to use camera or existing images shows up. Whatever I click, the InApp browser crashes, and I can't visit the link until the FB app is restarted.


Android 4.3: The InApp browser doesn't crash, but no dialog box comes up whatsoever. So when the user click on the file upload field, nothing happens.


I tried to insert a script which detects if the form is opened by the Facebook InApp browser and redirect to a _blank page (for it to open in the browser), but that doesn't work either, and I'm out of options.


It's not really an option to output a message to the user that he/she has to open the form in a browser.


Is there an easy way to fix this apart from these?


Edit: The problem doesn't occur in the FB Messenger app, only with the normal FB app.


Visual Basic - Issue connecting forms and displaying input

I have a basic program I am writing for a project, where you order a candle. On a form (frm_Order) I have labels for input of name, address, zip etc. Then you hit proceed and it takes you to the next form. On that form it is a summary of the order both the customer information, and the contents of the cart (lst_cart) on the first form (frm_items).


I have two boxes summarizing the order where I would like the output to be the items that were in the cart as well as the input from the order form containing the customer information. How do I write the module to display those inputs from the previous forms? Also when it opens each proceeding form, how do I make the previous one close so that there aren't 3 windows open?


Google Chrome Autofill - How to disable

I have a page to search for a address, which uses the info typed by the user to get the desired address.


Lately chrome has been showing the autofill option in the address field. I've search throughout the web and couldnt really see a workaround that would work. I've tried autocomplete="off" but with no luck


Is there any efficient way to prevent google chrome not only store form information but also use the autofill feature ?


I want to do this on client side (HTML)


Best Regards, Rui duarte


How to fill a PDF/A-1 in Java

I've got a pdf/a-1 form which I have to fill in Java.


The problem is, it works perfectly fine with normal pdf but not with pdf/a-1.


Using a normal pdf form, I display the form fields and implement an HashMap from which I generate myself an fdf file.


Then I import my fdf file into the normal pdf form using pdftk.exe and it works fine.


Using the pdf/a-1 form, I can't display fields and If I try to import an fdf file, it doesn't fill the form.


I don't know if there is a simple method which can fill a pdf/a-1 form or if I should use some mechanisms to make my pdf/a-1 fillable?


I've tried pdfbox and itext but didn't really find anything.


Hope you could help.


Best regards.


collapse inline form bootstrap

i've added a inline-form to my page, in the main area,


the form is a bit to wide, i would like that it collapse at 991px,


but the rest of the page can collapse at 767px


i understand it can be done with mediaquery but not sure on what to code.


i'm stuck here! what can i do?


i copied the inline form originally from a navbar of a file, the button is working fine.


it look like this:



<div class="text-center">
<button
class="btn btn-default form-toggle"
type="button"
data-toggle="collapse"
data-target="#collapseExample"
aria-expanded="false"
aria-controls="collapseExample">
<span class="sr-only">Toggle navigation</span>
Reservations
</button>
</div>

<div id="collapseExample" class="navbar-collapse collapse">

<div class="text-center ">

<form class="form-inline navbar-form" name="bookerform" action="---" method="GET" target="_self">
<div class="form-group">hidden elements</div>
<div class="form-group">arrivo</div>
<div class="form-group">partenza</div>
<div class="form-group text-left"> Numero N</div>
<div class="form-group text-left"> Numero A</div>
<div class="form-group text-left"> Numero B</div>
<div class="form-group"> button check</div>
</form>

</div>

</div>



<!-- Form end -->

TokenMismatchException on different workstations

Laravel 5 Website:


When my co-workers submit forms on the website, they are getting the error: tokenmismatchexception


My co-workers are both running on Mac-os and using Mamp to host the website.


I myself am running on Windows 7 64bit and using Xamp. I have never run into this error myself.


We all are using source-tree and they have the exact same project as me. Completely unedited. They've tried deleting and cloning it again but still the same problem.


This question is quite vague but I'd appreciate if someone could give some insight on what to look into for possible solutions.


Passing form object to another method

Im trying to pass a form object from the method that creates it to one that will show it and set a few properties on it, instead of having the smae code in each button event. Im getting the error "Argument 1: cannot convert from 'ref RWCStatTracker.Fixture.FRMAddFixture' to 'ref System.Windows.Forms.Form'" and "The best overloaded method match for 'RWCStatTracker.Form1.showForm(ref System.Windows.Forms.Form)' has some invalid arguments" These are occuring on line 70 in the button click event where it has showForm(ref frm);



public void addToolStripMenuItem3_Click(object sender, EventArgs e)
{
RWCStatTracker.Fixture.FRMAddFixture frm = new RWCStatTracker.Fixture.FRMAddFixture();
showForm(ref frm);
}

public void showForm(ref Form frm)
{
frm.TopLevel = false; //set it's TopLevel to false

Controls.Add(frm); //and add it to the parent Form
frm.Show(); //finally display it

frm.BringToFront(); //use this it there are Controls over your form.
}


I've found many articles on google but none are really achieving what im trying to achieve


Any ideas how I can make this work?


Typo3 powermail optin redirect

My static form works like a charm. But when I try to use the optin, the redirect breaks. The redirect is to the same page where the form is send from and additionally my form is hidden an the optinmessage is shown. I want to achive, that I am redirected to a special id and that my form is shown again without the message. Here my code. It´s a static code which I place at the footer, because this form is on every page.



lib.newsletterform < tt_content.list.20.powermail_pi1
lib.newsletterform {
settings.setup {
thx.redirect = {$page.pages.newsletter.thankyou}
receiver {
email = {$page.newsletter.receiver.email}
name = {$page.newsletter.receiver.name}
subject = {$page.newsletter.receiver.subject}
}
sender {
email = {$page.newsletter.sender.email}
name = {$page.newsletter.sender.name}
senderName = {$page.newsletter.sender.senderName}
senderEmail = {$page.newsletter.sender.senderEmail}
subject = {$page.newsletter.sender.subject}
}
main {
# newsletterform
form = 1
optin = 1
pid = 37
}
}
view {
# set new template for footer layout
templateRootPath >
templateRootPaths >
templateRootPaths {
10 = packages/Sites/page/Resources/Private/plugins/powermail/TemplatesFooter/
}
}
}

How to POST form data from within a table to PHP

I currently have a Timesheet form I am creating for the employees at my work and I am stuck at getting the input values to post correctly. I have a database set up but right now, I can't even get the values to show in a .php page. Here is a sample from my current table:



<html>
<form method="POST" form action="result.php">
<table>
<tr><td><b>Day of Week</td><td><b>Week 1 Hours</td><td><b>Week 2 Hours</td> <td>
<tr><td>Monday</td><td>
<input type="text" name="Monday" size="3" maxlength="4" value="" onkeypress="return inputLimiter(event,'Numbers')">
<input type="checkbox" tabindex="-1" name="Stime1">Sick?<input type="checkbox" tabindex="-1" name="Vac1">Vacation?</td>
<td><input type="text" name="Monday2" size="3" maxlength="4" value="" onkeypress="return inputLimiter(event,'Numbers')">
<input type="checkbox" tabindex="-1" name="Stime2">Sick?<input type="checkbox" tabindex="-1" name="Vac2">Vacation?</td></tr>
</table>
<input type="submit" value="submit">
</html>


This pattern continues for each day of the week. And then when I try to view the results of the post I couldn't get anything to work. I resorted to trying:



<html>
<?php var_dump ($_POST);
?>
</html>


All I get is a blank page, and if I view source it just shows the php code used. It's late here so I must be too tired and missing something but I just can't figure it out. Any and all help is much appreciated.


Thanks!


Creating a search text box in an Access 2013 Navigation Subform

I created a search text box in Access 2013 that works as in should in the form. When I moved the form to the Navigation form it stopped working. I receive the following error: "The action or method is invalid because the form or report isn't bound to a table or query." I have changed the condition in the Embedded Macro to read as follows:



[conLastName] Like "*" & [Forms]![frmNavigation]![NavigationSubform].[Form]![TxtSearchContacts] & "*"


I have also tried:



[conLastName] Like "*" & [Forms]![frmNavigation].[NavigationSubform].[Form]![TxtSearchContacts] & "*"


And:



[conLastName] Like "*" & [Forms]![frmNavigation]![NavigationSubform]![Form]![TxtSearchContacts] & "*"


Any and all insight would be greatly appreciated. I have spent well over two hours beating my head against the wall on this one. Thank you. ~Christa


Form not sending, directs to php file but does does nothing

I have a contact form on a site and use php to send the message, I took the php file from another site I created and changed it to suite the needs of this site which is why I don't see where the problem is, it worked fine on the other site. The PHP is here:



<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Submitting...</title>

</head>

<body>

<?php
$name = $_POST ['name'];
$company = $_POST['company'];
$phone_number = $_POST['phone_number'];
$email = $_POST['email'];
$client = $_POST['current-client'];
$office = $_POST['office'];
$enquiry = $_POST['enquiry'];
$formcontent = "Name: $name
\n Company: $company
\n Phone Number: $phone_number
\n Email: $email
\n Client: $client
\n Office: $office
\n Enquiry: $enquiry";
$recipient = "tristan.dyas@gmail.com";
$subject = "$office Website contact";
$mailheader = "From: $email \r\n";
ini_set("sendmail_from","tristan.dyas@gmail.com");
mail($recipient, $subject, $formcontent, $mailheader) or die("Please try again.");
echo "Form Submitted.";
header("Location: http://ift.tt/19vntly");
?>

</body>
</html>


And the html:



<div id="contact_form_container">
<form id="contact_form" name="contact_form" method="post" action="mail.php">
<table width="" align="center" border="0">
<tr>
<td colspan="3" align="center" style="height: 4.0em;">&nbsp;</td>
</tr>
<tr>
<td class="label-cell"><label for="name">Full Name*</label></td>
<td>&nbsp;</td>
<td class="label-cell"><label for="company">Company Name (If Applicable)</label></td>
</tr>
<tr>
<td width="145"><input type="text" name="name" id="name" class="text" /></td>
<td width="25" rowspan="8">&nbsp;</td>
<td width="145"><input type="text" name="company" id="company" class="text" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="label-cell"><label for="email">Email Address*</label></td>
<td class="label-cell"><label for="phone_number">Phone Number*</label></td>
</tr>
<tr>
<td><input type="email" name="email" id="email" class="text" /></td>
<td><input type="number" name="phone_number" id="phone_number" class="text" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="label-cell"><label for="current-client">Current Client?*</label></td>
<td class="label-cell"><label for="office">Office (If Applicable)</label></td>
</tr>
<tr>
<td><select name="current-client" id="current-client-drp" class="dropdown-select">
<option selected>Please Select...</option>
<option>Yes, current client</option>
<option>No, not a client</option>
<option>No, previous client</option>
</select></td>
<td><select name="office" id="office-drp" class="dropdown-select">
<option selected>Please Select...</option>
<option>Cotteridge</option>
<option>Handsworth</option>
<option>Solihull</option>
<option>Grimsby</option>
</select></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="center"><label for="enquiry">Message:</label></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="center"><textarea name="enquiry" id="enquiry"></textarea></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="center"><input name="submit" type="submit" id="submit" form="contact_form" formaction="mail.php" formenctype="multipart/form-data" formmethod="POST" formtarget="_self" title="Submit" value="Submit"></td>
</tr>
</table>
</form>
</div>


When I fill out the form and hit submit, it goes to the sending page, but just sits there and does nothing. The message does not send either. It's a simple form, I have checked and double checked but I am not great with PHP, I focus more on HTML and CSS so this is a little outside my comfort zone. Any help will be greatly appreciated.


Why can't my jQuery transitions be seen during form submission?

I want to create a transition indicating form submission is in progress when user click the submit button. I have the following codes.



$('div').on('submit', 'form', function(e){

if (transition_done === true) {
transition_done = false; // reset flag
return; // let the event bubble away
}

e.preventDefault();

$('.button').hide();
$('.transition').show();

transition_done = true; // set flag
this.submit();

});


The effect is doing OK on web. But when browse on mobile using the Android browser, the effect doesn't show up. INstead, it submits the form directly. Why is it like that and how can I fix it? Thanks!