Gravity Form Field Focus - gravity-forms-plugin

I want to to add focus on the first field of my gravity form my form if is 39 and the first field id is 1 can someone can tell me how can I achieve this and what code I need and where to paste that code, for your information i am using hello elementor theme.
Please help me with code or snippet.

Add the following to an HTML field at the top of your form:
<script>
jQuery(document).ready(function($) { jQuery('#input_39_1').focus(); });
</script>

Related

Tip: How to add placeholder to textarea in Ninja Forms Wordpress plugin

This is actually not a question. I just felt that I needed to share this small piece of magic with all peeps out there having a hard time with getting a placeholder in the Ninja Forms textarea field.
So, basically what you need to do is add the following code to your header.php file in the head section, then change the ID of the textarea and choose your placeholder text.
<script type="text/javascript">
jQuery(document).ready(function($){
$('#yourTextareaID').attr("placeholder","Your placeholder value");
});
</script>
Hope this can help you save some time. You can thank me later.
A way of doing this to make it work for any textarea would be to set (in Ninja forms) the default value of the textarea as whatever you want the placeholder to be and then on page load, take the content of the each textarea, add it to the placeholder attribute, then remove the content:
$(document).ready(function() {
// Remove textarea content and add placeholder
$("textarea").each(function() {
var $this = $(this);
$this.attr("placeholder", $this.val());
$this.val("");
});
});
Great! Thanks. In my case the ID was 30, so my code ended up being:
<script type="text/javascript">
jQuery(document).ready(function($){
$('#ninja_forms_field_30').attr("placeholder","Your placeholder value");
});
</script>

How to reset angularjs character count binding in form

I have multiple form fields in an angular view that count down characters as the user types. However, I have a button/link that should reset all the form fields and character counts. When clicked, the form is reset but the character counts are not updated to reflect the change. I know there has to be a model connection I am missing here (I'm an angular newbie). I also know it's probably best to rest the form using $setPristine();, but I am unable to get that to work.
Here's what I've got: http://embed.plnkr.co/5SGjqPhYYIZF1qp0QAAT/preview
I'd appreciate any help I can get! Thanks!
The problem is that your reset button isn't updating the Angular model values your character count calculations rely upon.
Instead of using reset on the form element, just clear the model values:
HTML:
<a href ng-click="clearForm()">RESET</a>
Controller:
$scope.clearForm = function() {
$scope.TA3 = '';
$scope.TA4 = '';
}
Revised Plunker

How to send multiple forms with one button in Contao?

I have a question about the wrappers/accordeons. I now have multiple wrappers and in each wrapper there is a form. Now, I want one sendbutton on the end of the page. The sendbutton which will send all the forms that have been filled in at once.
How can I do that?
I don't know why you want to break input into different forms and then submit them again at once. Would it not make sense to use one form and submit the data and process it the way you want using the processFormData hook? may be because you want the accordion to group you form fields. Let me help you this way:
Create your form in the format shown below. Make sure the form has a tabless layout to be able to use fieldsets.
Create a fieldset without a label. You may add the class ce_accordion just in case you have some styling attached to it.
Create a field of type html and add the following markup.
<div class="toggler">Form 1 headline here</div>
Create another field with the following markup
<div class="toggler">
Now create your input fields from here. for example a text field,textares.
Create a field of type html to close html markup created in step 3
</div>
Create a fieldset wrapper end here.
The above steps can be repeated as many as how many groups of fields you want to create in an accordion.
Now create you submit button here and it will send all your data the way you want.
Just a by the way:
If some one submits a form in a wrapper that is closed, how will he know which wrapper has error fields?
$(document).ready(function() {
$(".ce_accordion").each(function(index,el) {
if($(this).find("p.error")){
$(this).addClass("hasErrors");
$(this).find("div.toggler").addClass("active").attr("aria-expanded","true");
}
});
​});​
You can now add a style for .hasErrors rule

Orchard - add class or id to the body using fields

My questions is - how do I add a class or id to the body tag using a text field within Orchard?
So if I enter the word "product" in the text field then the result should be <body class="product">. I want to use this method instead of creating alternate layout templates as every page has the same layout but I need a different class for each page to reference a different colour scheme I have setup for each page in my CSS.
I have added a text field with the name Area to the Title ContentType in the backend. My problem is now how to get the value of the field to be put into the body in the Document.cshtml.
I have read Setting Unique Body Classes and IDs in Orchard and Using Alternatives for Document.cshtml in Orchard CMS but I still can't get it to work! The second one seems like what I want to do but so far I have been unable to acheive it.
Any answer would be very appreciated?
Thanks
Andy
I am so frustrated that there is no readily available solution found in the net about this. Since I am more comfortable coding in jquery & js...
Here's my solution: Assuming you have jquery loaded...
#using(Script.Foot()) {
<script type ="text/javascript">
//<![CDATA[
$(document).ready(function () {
var url = window.location.pathname;
var count = url.match(new RegExp("/", 'g'));
var urlsplit = url.split("/");
var page_class = urlsplit[count.length];
alert(page_class);
$('body').addClass(page_class);
});
//]]>
</script>
}
The easiest way to achieve this is to use the Classy feature from Vandelay.Industries.

Loading results of form into specified DIV

I am trying to target a specific div with the results of a form post.
I have found the below code, but am unclear on where the URL for the page that handles the form data is specified. Any help greatly appreciated.
$("form1").submit(function() {
$.post($(this).attr("action"), $(this).serialize(), function(html) {
$("#someDiv").html(html);
});
return false; // prevent normal submit
});
For example, I want to send form id="form1" to somepage.php, and have somepage.php displayed into div id=someDiv.
In that code-snippet, $(this).attr("action") is the URL: it's taken from the action="..." attribute of the <form> element. If, for whatever reason, you don't want to use that attribute to specify the URL, you can replace $(this).attr("action") with an explicit URL (as a string).
It is defined in the action attribute of your form tag