Submit form in iframe strange results - forms

I have this test page which has an iframe within. If I search for something (i.e. PR, IT) on parent page form, it triggers results in iframe but with one small problem, we don't have correct options on the left column, which is filtering options (nr. of jobs resulted,city selection,etc). If I search on iframe itself for the same thing, results comes correct and we can filter results. I don't understand what I did wrong.
This is the parent page form that triggers results in iframe :
<form id="SearchForm" action="http://mysite.com/search-results-jobs/" target="my-iframe" method="post">
<input type="hidden" name="action" value="search" />
<input type="hidden" name="listing_type[equal]" value="Job" />
<label><strong>What?</strong>
<em>
<input type="text" value="job title, keywords or company name"
onblur="if(this.value=='') this.value='job title, keywords or company name'"
onFocus="if(this.value =='job title, keywords or company name' ) this.value=''" name="keywords [all_words]" />
</em></label>
<label><strong class="color">Where?</strong><b><input type="text" value="city, state or zip code"
onblur="if(this.value=='') this.value='city, state or zip code'" onFocus="if(this.value =='city, state or zip code' ) this.value=''" name="City[all_words]" /></b></label>
Search
<input type="submit" id="btn-search" class="button" value="Cauta"/></form>

Related

Wicket: access field from inner form

I have a Wicket page with this structure:
<form wicket:id="generalForm" method="post" class="form_recherche">
<input value="" type="text" wicket:id="myField_1" />
<form wicket:id="innerForm" method="post">
<input value="" type="text" wicket:id="myField_2"/>
<input type="submit" class="button-classic" wicket:id="accept_2"/>
</form>
<input type="submit" class="button-classic" wicket:id="accept_1" />
</form>
1 external form with 1 inner form. One field each. The fact is that when the "accept_2" button is clicked, the field "myField_1" is not submitted to the server (only the "myField_2" is submitted). And in fact, I would need the "field_1" field to do some validation.
What am I missing and why isn't the "myField_1" being filled on the server why "accept_2" is clicked?
You need to override Form#wantSubmitOnNestedFormSubmit() on the outer Form to return true. This way you will tell Wicket that you want the (outer) form to be submitted as well when one of its nested forms is submitted.
You used SO tags wicket-1.5 and wicket-1.6. I am not sure whether this method is available for your version of Wicket.

Front end entry form with Craft CMS

I am trying to create a form with Craft that allows users to rate entries in a specific section. The section that tracks the ratings has three fields: the ratings drop-down field, a user field, and an entry field. Here is my form right now:
<form method="post" accept-charset="UTF-8">
{{ getCsrfInput() }}
<input type="hidden" name="action" value="entries/saveEntry">
<input type="hidden" name="redirect" value="viewentry/{slug}">
<input type="hidden" name="sectionId" value="userRatings">
<input type="hidden" name="enabled" value="1">
<input type="text" id="user" name="ratings" value="{{currentUser}}" style="display:none;" readonly>
<input type="text" id="restaurant" name="restaurant" value="{{entry.id}}" style="display:none;" readonly>
<label for="ratings">Rate This Restaurant</label>
<select id="ratings" name="ratings" required>
{% for option in entry.ratings.options %}
<option value="{{ option.value }}">{{option.label}}</option>
{% endfor %}
</select>
<input class="button" type="submit" value="Rate">
I have two text boxes that are recording the current user and the Entry ID of the entry I am trying to rate (we are on the _entry.html for this entry). Before I added the "display:none" they were both showing the correct information. Then I am pulling the options for the ratings field that I set in craft and setting them as the values for the drop down here (which is working).
When I try to submit I get a craft error: "Internal Server Error Trying to get property of non-object." Any help or suggestions would be greatly appreciated!
You're missing the 'title' field ..
<input type="hidden" name="title" value="Free Registration Title">
It's a requirement

How can I pass variables from 2 separate forms on one cfm to another cfm in coldfusion?

I have 2 forms on one page that I need to pass to the same page to assemble a pdf. How can I do that? I have tried using a action="post" for one and action="get" for the other, but I can't get that to work. I have tried assigning one form to session variables, but I can't get that either. Any suggestions??
<form name="formOne" id="formOne" method="post" action="#buildURL('goTothisPage.page')#">
<input name="name" id="name" autofocus="true" >
<input name="address" id="address" >
I would try just creating one big form instead of 2 smaller forms if the action is going to be the same and go to the same .cfm page. (Just expand the scope of your tags)
You can also create 2 "Submit" buttons (1 for each form) to make it appear as 2 separate forms, even though the buttons will submit the same form.
If it is required to have two separate forms in your html, it is also possible to forge the form values from one form into the other at the moment of the submit event.
HTML:
<form name="formOne" id="formOne" method="post">
<input name="name" id="name" type="text" >
<input name="address" id="addressHidden" type="hidden">
</form>
<form name="formTwo" id="formTwo" method="post">
<input name="address" id="address" type="text">
<input name="name" id="nameHidden" type="hidden" >
</form>
Javascript:
$(document).ready(function(){
$('#formOne').submit(function(event){
$('#addressHidden').val($('#address').val());
return true;
});
// same for #formTwo
$('#formTwo').submit(function(event){
$('#nameHidden').val($('#name').val());
return true;
});
});

MODX FormIt validation checks only `required`

I have a contact form on my site. I use formit for its FormIT validation. I want email be not more than 40 characters, be reqired and be correct email address. Message field is required too and has max length set.
Validator doesn't work correctly:
When required fields are empty, it shows error message and doesn't allow to send the form (this situation is absolutely correct)
When in email is any text (valid or not), form is sent but redirect to success page doesn't work (so it happens also when we enter more than max length)
[[!FormIt?
&hooks=`spam,email,redirect,FormItAutoResponder`
&emailTpl=`emailTplContact`
&emailSubject=`Message from site.com`
&emailTo=`myemail#gmail.com`
&validate=`email:email:required:maxLength=^40^,
message:required:maxLength=^150^`
&redirectTo=`11`
&fiarTpl=`emailAutoRespond`
&fiarSubject=`Your message is sent`
&fiarFromName=`My Site`
&fiarFrom=`myemail#gmail.com`
&fiarToField=`email`
&fiarReplyTo=`email`
]]
<form id="contact-form" method="post" action="[[~[[*id]]]]" enctype="application/x-www-form-urlencoded" role="form" data-toggle="validator" name="order">
<input type="text" id="name" name="name" type="name" placeholder="Name" value="[[!+fx.name]]" size=25>
<input type="text" required="required" type="email" id="email" name="email" placeholder="Email" value="[[!+fx.email]]">
[[!+fx.error.email]]
<textarea required="required" placeholder="Message" id="message" name="message">[[!+fx.message]]</textarea>
<button name="send">Send</button>
</form>
</div>
You have type attribute twice in the name input and the email input, so that might be the problem.
<input type="text" id="name" name="name" type="name">
<input type="text" required="required" type="email">
Remove type="name" and type="email" -- (leave type="text")
Also - I have only ever used a prefix of fi for Formit placeholders; do you know for sure that fx will work? Did you set that somewhere else? You say you're seeing the error message so I guess the error placeholder must be working...
Be sure to add placeholderPrefix to your FormIt call:
[[!FormIt?
&placeholderPrefix=`fx`
&hooks=`spam,email,redirect,FormItAutoResponder`
&emailTpl=`emailTplContact`
&emailSubject=`Message from site.com`
&emailTo=`myemail#gmail.com`
&validate=`email:email:required:maxLength=^40^,
message:required:maxLength=^150^`
&redirectTo=`11`
&fiarTpl=`emailAutoRespond`
&fiarSubject=`Your message is sent`
&fiarFromName=`My Site`
&fiarFrom=`myemail#gmail.com`
&fiarToField=`email`
&fiarReplyTo=`email`
]]

Get all form controls in angularjs

What I would like to do is make all fields show their validation errors when:
visiting and modifying a field so that its dirty state is triggered (the default), and also
validating and triggering dirty when the submit is pressed
Take the following form
<div ng-form="MyForm">
<label>
<input type="text" name="numbers" ng-required="'true'" ng-pattern="/^[0-9]*$/" ng-model="numbers" />
<span class="error" ng-show="numbers.$error.required">Required</span>
<span class="error" ng-show="numbers.$error.pattern">Pattern</span>
</label>
<label>
<input type="text" name="characters" ng-required="'true'" ng-pattern="/^[a-z]*$/" ng-model="characters" />
<span class="error" ng-show="characters.$error.required">Required</span>
<span class="error" ng-show="characters.$error.required">Pattern</span>
</label>
<button ng-click="validateAndSubmit()">Submit</button>
</div>
Essentially, I would like to create a directive that validates (sets dirty to true) for all the controls in an arbitrary form. Is there a simple way to get the form controls from the FormController without finding the actual dom elements?