Gravity Forms - Add different CSS classes to First and Last Name fields - gravity

In the Gravity Forms, First and Last name fields are actually inside the "Name" field.
I can add a CSS class to the Name field, but I cannot add different CSS classes to each First and Last name fields.
Is this possible? Is there a filter hook or something that I missed?

You can add an HTML field at the top of your form with the following script:
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#input_60_58_3").addClass("milk");//replace '60' with your form id, replace "58" with the name field id, leave the 3 as that is needed to isolate the first name
jQuery("#input_60_58_6").addClass("cookies");//replace '60' with your form id, replace "58" with the name field id, leave the 6 as that is needed to isolate the last name
});
</script>

Related

Why default lines for One2many fields are not filling in related and default values automatically in Odoo 13?

I have a button in the model sale.order with executes the method action_open_certification_views. This method opens the sale.certification tree view. So the method returns the dictionary of the action which opens the sale.certification views, and I have added the following context to auto-fill in the sale.certification fields (sale_id and line_ids, where line_ids is a One2many field pointing to sale.certification.line):
def action_open_certification_views(self):
...
action['context'] = {
'default_name': 'My Certification',
'default_sale_id': self.id,
'default_line_ids': [
(0, 0, {
'quantity': 5.0,
'sale_line_id': line.id,
}) for line in self.order_line
],
}
return action
When I click on the button, the sale.certification tree view is opened right, and if click on Create button, the context of the action is working well since I see the sale.certification form filled in automatically with the default name My Certification, the right link to sale order, and the same number of certification lines as sale order lines has the sale order. Each of this certification lines has quantity 5.0, and the link to sale order line is right too.
The problem is that the sale.certification.line model has many other fields which are related or which have default values, but these certification lines filled in by default by the action context are not filling in those fields.
For example, there is another field quantity2 in sale.certification.line model, and visible in the view, which always takes by default 1.0. However, the field is empty in all default lines. Same problem with related fields. There are some related fields in the view which take their values through sale_line_id field. These one is filled in OK, but the related fields remain empty. For example, in `sale.certification.line model there is this field:
product_uom = fields.Many2one(
related='sale_line_id.product_uom',
)
In spite of having sale_line_id filled in OK in all lines, they have product_uom empty. Can anyone tell me why? Do I have to specify their values in context too, despite they should have been filled in by theirselves?

How to change tabulator Pagination buttons text and position

First part of the question is I want to simply change the original buttons "First", "Prev" and so on to some other text.
here is a link that shows original btns.
My second part of the question is how can i display the pagination in a footer out side the table
such as:
<table></table>
<div class:"footer">
pagination
</div>
There are several options you can use to change the pagination setup
Button Text
If you are looking to change the text, then the localisation system allows you to change any text for any part of the table, for full details see the Localization Documentation
var table = new Tabulator("#example-table", {
locale:"en-gb",
langs:{
"en-gb":{
"pagination":{
"page_size":"Page Size", //label for the page size select element
"first":"First", //text for the first page button
"first_title":"First Page", //tooltip text for the first page button
"last":"Last",
"last_title":"Last Page",
"prev":"Prev",
"prev_title":"Prev Page",
"next":"Next",
"next_title":"Next Page",
},
}
},
});
Button Position
If you simply want to change the position of the pagination element within the footer you can use CSS. The Styling Documentation contains a full list of classes used for styling the pagination elements.
To move the elements to the left hand side of the footer for example you would ned to use the following CSS:
.tabulator .table-footer{
text-align:left;
}
External Footer Element
if you want Tabulator to put the pagination elements into an element outside of the table, then you just need to pass the query selector for the element into the footerElement property in the table constructor. The Footer Layout Documentation contains full details on this.
In the example below i am assuming you have an element outside the table with an id of "my-footer" that you want the elements to appear in:
var table = new Tabulator("#example-table", {
footerElement:"#my-footer",
});
Here is the first part of the question:
$(".tabulator-paginator").find($(".tabulator-page[title='Next Page']")).text('>');
$(".tabulator-paginator").find($(".tabulator-page[title='Last Page']")).text('>>');
$(".tabulator-paginator").find($(".tabulator-page[title='First Page']")).text('<');
$(".tabulator-paginator").find($(".tabulator-page[title='Prev Page']")).text('<<');
As far as the second part tabulator have to keep the footer inside the table for it's javascript(the one the does pagination) to work. Hopefully in future updates it would let us do that, as it would provide more ability to custom the css.

Kentico Admin - Dynamically Change and SAVE Field Name, Value and Label

For a custom page type, I have a multiple choice form filed as seen in image 1 and 2. I was able to set it up (using jquery) so that when I click on other checkboxes belonging to a another field, the checkbox Label and value of this field is changed accordingly as seen in image 3 - 'Author1', 'Author2', 'Author3' were replaced with something else.
The problem is when I hit the Save button, all of my new label/value are not Saved, but the checkbox value and label return to its original value.
Is there a way to make it so that these checkboxes can accept new value and the new value can be saved. Thanks!
Where does authors values come from? Database? You should be able to use SQL query as data source for multiple choice control. This will allow you to store actual values into database whenever you save a page on the Form tab.
So the idea is to load actual values, replace them with 'AuthorN' and change back to original value when checked.
I've set up an example which might help you. I've created a form with three fields:
FirstAuthor
Type: Integer
Form control: Radio buttons
Data source: SQL Query (select userid,username from cms_user)
Has depending fields: true
SecondAuthor
Type: Integer
Form control: Radio buttons
Data source: SQL Query (select userid,username from cms_user)
Has depending fields: true
OrderedAuthors
Type: Text (1000)
Form control: Label
Default value: {% (if(firstauthor>0) { GlobalObjects.Users.Where("userid="+firstauthor)[0].UserName } else {""}) + ", " + (if(secondauthor>0) {GlobalObjects.Users.Where("userid="+secondauthor)[0].UserName} else {""} #%}
Depends on another field: true
I guess you have a list of authors somewhere in the database so you can just replace CMS_User table with your table. Then all you need to do is to adjust the macro in the third field to give you results you want.

find_field with Poltergeist/Capybara

I have a problem with Poltergeist. I can’t get the driver to locate a field on a page. What I want to do is to execute some js to make sure that the input field is empty before I start adding new text. I have a field with a label os "Skill list" and id of "user_skill_list". In order to make the step more generic I want to find the field by the label name and then get the id.
And(/^I delete the content of "([^"]*)"$/) do |label|
field_id = page.find_field(label).native.attributes['id'].value
page.execute_script("$('#{field_id}').val('');")
end
Here's the error message:
#javascript
Scenario: Update user by removing # features/godmin/skills.feature:36
Given "Thomas" skills are "rspec, testing" # features/step_definitions/godmin_steps.rb:63
And I click on "Edit" for "Thomas" # features/step_definitions/godmin_steps.rb:43
And I delete the content of "Skill list" # features/step_definitions/godmin_steps.rb:69
Unable to find field "Skill list" (Capybara::ElementNotFound)
./features/step_definitions/godmin_steps.rb:70:in `/^I delete the content of "([^"]*)"$/'
features/godmin/skills.feature:39:in `And I delete the content of "Skill list"'
```
My cucumber set up is pretty basic.
# features/support/env.rb
...
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
Capybara.default_max_wait_time = 5
...
Thank you. Please let me know if I should clarify my question.
Assuming your html is something like
<label for="user_skill_list">Skill list</label>
<input id="user_skill_list"/>
Then
page.find_field('Skill list').set('')
should find the field and clear it. If it's not finding the element there are a couple of possibilities.
The element isn't visible on the page
There is CSS being applied that is changing the case of "Skill list"
There are typos in your html so the label isn't actually associated with the field. You can test this by just doing page.find_field('user_skill_list').set('') so the label isn't involved
Note: you can get the id by just doing page.find_field('Skill list')[:id] rather than having to resort to .native.xxxx - although it's not really needed for this use case

Alloy user interface (access a tag value)

I'm working with liferay portal 6.2. And I want to get the value of the text in a tag with alloy user interface.
exemple:
<div>
<p> Paragraph </p>
"value"
</div>
the desired result is: value
please help.
AlloyUI, being an extension of YUI3, uses get/set methods to access and manipulate the properties/attributes of the object (YUI3 Node / AlloyUI Node) that is returned when looking up elements from the page.
Some examples can be reviewed in this documentation as well as this documentation.
In general you'll need something unique (i.e. id, css class) to the div in order to fetch only that element. Once you have that element, divNode.get('text') will give you all of the text within the element. There is not a means to easily "skip" the paragraph contents within the div without the value being contained within some other markup. If you have control over the markup and can do this, that would be the best option. Otherwise you are left to using the replace function to strip out the paragraph contents from the text.
<script>
AUI().use('aui-base', function(A) {
var paragraphText = A.one('#myDiv>p').get('text');
var divText = A.one('#myDiv').get('text')
var onlyValue = divText.replace(paragraphText, "").trim()
console.log(onlyValue)
})
</script>

Resources