在Wordpress中联系表单

时间:2016-09-18 16:29:49

标签: wordpress contact-form-7

如何在联系表格7上创建这样的字段?

HTML:

import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.TreeMap;

import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

import org.jsoup.Jsoup;
import org.jsoup.Connection.Method;
import org.jsoup.Connection.Response;
import org.jsoup.nodes.Document;

import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;

public class MoisAirfrancee2 {

    private static class DateObject{

        private Double taxes;
        private Double price;
        private Double htPrice;

        public DateObject(Double price, Double htPrice, Double taxes){
            this.taxes = taxes;
            this.price = price;
            this.htPrice = htPrice;
        }

        public Double getTaxes() {
            return taxes;
        }

        public Double getPrice() {
            return price;
        }

        public Double getHtPrice() {
            return htPrice;
        }
    }

    public static void main(String[] args) {

        Map<String, DateObject> prices = new TreeMap<String, DateObject>();
        File f = new File(System.getProperty("user.home") + "\\Desktop\\Test.xls");

        WritableWorkbook myexcel = null;

        try {

            myexcel = Workbook.createWorkbook(f);
            WritableSheet mysheet = myexcel.createSheet("AirFrance Novembre ", 0);

            Response response = Jsoup
                    .connect("http://www.airfrance.fr/vols/paris+tunis")
                    .userAgent("Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36")
                    .method(Method.GET)
                    .timeout(2000)
                    .execute();

            Document doc = Jsoup
                    .connect("http://www.airfrance.fr/FR/fr/local/vols/getInstantFlexNewCalendar.do?idMonth=10&itineraryNumber=1")
                    .cookies(response.cookies())
                    .timeout(2000)
                    .userAgent("Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36")
                    .referrer("http://www.airfrance.fr/vols/paris+tunis").get();

            JSONObject obj = (JSONObject) new JSONParser().parse(doc.text());

            JSONArray dates = (JSONArray) obj.get("days");

            JSONObject dateObject;

            for(Object o : dates){
                if ( o instanceof JSONObject ) {
                    dateObject = ((JSONObject)o);
                    prices.put(dateObject.get("dallasDate").toString(), new DateObject((Double)dateObject.get("price"), (Double)dateObject.get("HTprice"), (Double)dateObject.get("taxes")));
                }
            }

            addLabel(mysheet, 0, 0, "Date");
            addLabel(mysheet, 1, 0, "Prix [€]");
            addLabel(mysheet, 2, 0, "PrixHt [€]");
            addLabel(mysheet, 3, 0, "Taxes [€]");

            int rowIndex = 1;
            DateObject date;

            for (String key : prices.keySet()) {
                date = prices.get(key);
                addLabel(mysheet, 0, rowIndex, key);
                addLabel(mysheet, 1, rowIndex, ""+date.getPrice());
                addLabel(mysheet, 2, rowIndex, ""+date.getHtPrice());
                addLabel(mysheet, 3, rowIndex, ""+date.getTaxes());
                rowIndex++;
            }

        myexcel.write();

        System.out.println("Scraping finished without errors.");

        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        } catch (WriteException e) {
            e.printStackTrace();
        } finally {
            try {
                myexcel.close();
            } catch (WriteException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    private static void addLabel(WritableSheet sheet, int column, int row, String s)
            throws WriteException, RowsExceededException {
        Label label;
        label = new Label(column, row, s);
        sheet.addCell(label);
    }
}'

JSFiddle

中的代码

1 个答案:

答案 0 :(得分:4)

它位于网站上的文档中:http://contactform7.com/checkboxes-radio-buttons-and-menus/

示例:

[选择你的国家&#34;中国&#34; &#34;印度&#34; &#34;圣马力诺&#34;]

相关问题