I am making use of the caxlsx_rails gem, and I am adding this dropdown:
sheet.add_data_validation("F6:F2000", {
:type => :list,
:formula1 => "=IFERROR(VLOOKUP(E6,Lista_de_novedades_disponibles!A$2:B$#{#select_novedades['novelty'].count+1},2,0),#{'"n/a"'})",
:showDropDown => false,
:showErrorMessage => true,
:errorTitle => '',
:error => 'Please use the dropdown selector to choose the value',
:errorStyle => :stop,
:showInputMessage => true,
:prompt => 'Choose the value from the dropdown'
})
but I need the first item to be automatically selected without the user having to select it. is this possible?
Related
I am using date_select. It has default months (January, February etc.). I want to change it, and add custom months (Ukraine month). I found an option for this, but I don't understand how it works.
This is my attempt:
<%= ht.date_select :data, :start_year => Date.current.year,
:use_month_names => {January: 'Січень',
:February => 'Лютий', :March => 'Березень', :April => 'Квітень',
:May => 'Травень', :June => 'Червень', :July => 'Липень', :August =>
'Серпень',
:September => 'Вересень', :October => 'Жовтень', :November =>
'Листопад', :December => 'Грудень' } %>
How does this option :use_month_names work?
From the docs it seems you have to pass an array with those names. Try
<%= ht.date_select :data, :start_year => Date.current.year,
:use_month_names => ['Січень', 'Лютий', 'Березень','Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'] %>
I use nova-repeatable-fields package for add more functionality. When I save data, "Unknown column 'employees' in 'field list'" error comes. employee field is not in database. My code like this:
Repeater::make('Employees')
->addField([
'label' => 'Full name',
'name' => 'full_name',
'type' => 'text',
'placeholder' => 'Full Name',
])
->addField([
'label' => 'ID No',
'name' => 'id_no',
'type' => 'text',
'placeholder' => 'ID No',
])
->addButtonText('Add')
->displayStackedForm(),
Please show image for better understand
I'm using the fedex gem version 3.9 and cannot get the "signature required" option printed on my fedex label.
This is how it looks:
label = fedex.label(
:filename => "public/labels/#{label_name}",
:shipper => shipper,
:recipient => recipient,
:packages => packages,
:service_type => service_type,
:signature_required => true,
:shipping_options => shipping_options)
I remember this used to work a couple of months ago but now it doesn't.
Let me know if you have any suggestions.
Best,
Turns out that the signature options should be sent as part of the packages. Then it prints the label with the right signature initials
packages = [{
:weight => {:units => "LB", :value => 3},
:dimensions => {:length => 10, :width => 5, :height => 4, :units => "IN" },
:special_services_requested => {:special_service_types => "SIGNATURE_OPTION", :signature_option_detail => {:signature_option_type => "DIRECT"} }
}]
label = fedex.label(
:filename => "public/labels/#{label_name}",
:shipper => shipper,
:recipient => recipient,
:packages => packages
:shipping_options => shipping_options)
I am filling PDF forms in my rails app with the pdf-forms (https://github.com/jkraemer/pdf-forms) gem, based on PDFtk. Text fields work as I would expect, but my checkbox fields do not. The boxes display well in Chrome, but in Preview and Mail the checkbox fields appear empty.
class FormsController < ApplicationController
require 'pdf_forms'
def acord25
#policy = Policy.find(params[:id])
pdftk = PdfForms.new('/usr/local/bin/pdftk')
# find out the field names that are present in form.pdf
pdftk.get_field_names 'lib/pdfs/acord25.pdf'
# take form.pdf, set the 'foo' field to 'bar' and save the document to myform.pdf
pdftk.fill_form '/lib/pdfs/acord25.pdf', "acord25.pdf",
"F[0].P1[0].Form_CompletionDate_A[0]" => #policy.dateIssued,
"F[0].P1[0].Producer_FullName_A[0]" => #policy.client.broker.name,
"F[0].P1[0].Producer_MailingAddress_LineOne_A[0]" => #policy.client.broker.company,
"F[0].P1[0].Producer_MailingAddress_LineTwo_A[0]" => #policy.client.broker.address,
"F[0].P1[0].Producer_ContactPerson_FullName_A[0]" => #policy.legalVesting,
"F[0].P1[0].Producer_ContactPerson_PhoneNumber_A[0]" => #policy.client.broker.phone,
"F[0].P1[0].Producer_FaxNumber_A[0]" => #policy.client.broker.fax,
"F[0].P1[0].Producer_ContactPerson_EmailAddress_A[0]" => #policy.client.broker.email,
"F[0].P1[0].NamedInsured_FullName_A[0]" => #policy.client.name,
"F[0].P1[0].NamedInsured_MailingAddress_LineOne_A[0]" => #policy.client.address.titlecase,
"F[0].P1[0].GeneralLiability_CoverageIndicator_A[0]" => 1,
"F[0].P1[0].GeneralLiability_OccurrenceIndicator_A[0]" => 1,
"F[0].P1[0].GeneralLiability_GeneralAggregate_LimitAppliesPerLocationIndicator_A[0]" => 1,
"F[0].P1[0].Policy_PolicyNumberIdentifier_A[0]" => #policy.policyNumber,
"F[0].P1[0].Policy_EffectiveDate_A[0]" => #policy.dateEffective,
"F[0].P1[0].PolicyExpirationGeneral[0]" => #policy.term.dayEnd,
"F[0].P1[0].Insurer_FullName_A[0]" => "Lexington Insurance Company",
"F[0].P1[0].Insurer_NAICCode_A[0]" => 19437,
"F[0].P1[0].Insurer_FullName_B[0]" => "Commerce & Industry Insurance Company",
"F[0].P1[0].Insurer_NAICCode_B[0]" => 19410,
"F[0].P1[0].Insurer_FullName_C[0]" => "Great American Insurance Company",
"F[0].P1[0].Insurer_NAICCode_C[0]" => 37532,
"F[0].P1[0].Insurer_FullName_D[0]" => "Admiral Insurance Company",
"F[0].P1[0].Insurer_NAICCode_D[0]" => 24856,
"F[0].P1[0].GeneralLiability_InsurerLetterCode_A[0]" => "A",
"F[0].P1[0].GeneralLiability_EachOccurrence_LimitAmount_A[0]" => 1000000,
"F[0].P1[0].GeneralLiability_FireDamageRentedPremises_EachOccurrenceLimitAmount_A[0]" => 50000,
"F[0].P1[0].GeneralLiability_MedicalExpense_EachPersonLimitAmount_A[0]" => "Excluded",
"F[0].P1[0].GeneralLiability_PersonalAndAdvertisingInjury_LimitAmount_A[0]" => 1000000,
"F[0].P1[0].GeneralLiability_GeneralAggregate_LimitAmount_A[0]" => 2000000,
"F[0].P1[0].GeneralLiability_ProductsAndCompletedOperations_AggregateLimitAmount_A[0]" => 2000000,
"F[0].P1[0].Vehicle_InsurerLetterCode_A[0]" => "A",
"F[0].P1[0].Vehicle_HiredAutosIndicator_A[0]" => 1,
"F[0].P1[0].Vehicle_NonOwnedAutosIndicator_A[0]" => 1,
"F[0].P1[0].Policy_PolicyNumberIdentifier_B[0]" => #policy.policyNumber,
"F[0].P1[0].Policy_EffectiveDate_B[0]" => #policy.dateEffective,
"F[0].P1[0].Policy_ExpirationDate_B[0]" => #policy.term.dayEnd,
"F[0].P1[0].Vehicle_CombinedSingleLimit_EachAccidentAmount_A[0]" => 1000000,
"F[0].P1[0].ExcessUmbrella_InsurerLetterCode_A[0]" => "B",
"F[0].P1[0].ExcessUmbrella_OccurrenceIndicator_A[0]" => 1,
"F[0].P1[0].ExcessUmbrella_DeductibleIndicator_A[0]" => 1,
"F[0].P1[0].ExcessUmbrella_Umbrella_DeductibleOrRetentionAmount_A[0]" => #policy.coverages.first.deductibleOcc,
"F[0].P1[0].Policy_PolicyNumberIdentifier_D[0]" => #policy.policyNumber,
"F[0].P1[0].Policy_EffectiveDate_D[0]" => #policy.dateEffective,
"F[0].P1[0].Policy_ExpirationDate_D[0]" => #policy.term.dayEnd,
"F[0].P1[0].ExcessUmbrella_Umbrella_EachOccurrenceAmount_A[0]" => 10000000,
"F[0].P1[0].ExcessUmbrella_Umbrella_AggregateAmount_A[0]" => 10000000
send_file("#{Rails.root}/acord25.pdf", filename: "#{#policy.client.name} - #{#policy.carrier.name} - #{#policy.policyNumber} (#{Time.now}).pdf", type: "application/vnd.ms-excel")
end
end
TL;DR: Checked boxes display in Chrome, but not in Preview or Mail.
I appreciate any help or leads on what the problem might be. Thank you!
Turns out the PDF form was corrupted. Had to recreate form, not a PDFTK issue.
Whenever a rails variable equals nil (or actually whenever i use rails code (see 3rd code sample)) i get a string of empty characters in my html.
new.html.haml
%h1.editable.editable_title_field{:contenteditable => 'true', :placeholder => "title"}
= #post_title //#post_title.present? returns false
%h4.editable.editable_subtitle_field{:contenteditable => 'true', :placeholder => "subtitle"}
= #post.subtitle
%p.editable.editable_intro_field{:contenteditable => 'true', :placeholder => "intro"}
= #post.intro
this results in:
i checked, and even:
%h1.editable.editable_title_field{:contenteditable => 'true', :placeholder => "title"}
- #post_title
and:
%h1.editable.editable_title_field{:contenteditable => 'true', :placeholder => "title"}
-
ends up the same as in attached image
because of those empty characters :empty css selector treats the element as if it was not empty and doesnt append content specified in :before
how do i get rid of those empty characters inside my html tags?
EDIT
screencast of this behavior:
http://quick.as/jqlaiorq
Try it with a < on the end of the %h1 line:
%h1.editable.editable_title_field{:contenteditable => 'true', :placeholder => "title"}<
= #post_title
See the whitespace removal info in the HAML documentation.