2017-04-21 12 views
-1

現在、動的フォームビルダを使用しています(ユーザーは任意のフォームを作成できます)。動的なので、入力がどのようになるかは、チェックボックスなどの質問になると予測します。したがって、私はJSON形式のポストメソッドWeb APIを使用して、フォーム入力をデータベースに正確に提出するのだろうかと思います。また、タグに基づいて新しいテーブルを作成できる必要があります。申し訳ありませんが混乱している場合は、私はこのフィールドに非常に新しいですし、助けなしに。POSTメソッドを使用してデータベースに動的入力を送信するJSON形式のWeb API

以下のコードは、xsltがHTMLページとしてウェブページに表示するxmlファイルです。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 

<form> 
    <display_name>In Store Hub Trooper Feedback Form</display_name> 
    <form_theme>SkyBlue</form_theme> 
    <show_score>True</show_score> 
    <calculate>True</calculate> 
    <db_table_name>form_for_hub_trooper_in_store_feedback_form_20160829174321</db_table_name> 
    <fieldset> 

    <field required="Y" is_admin_field="N"> 
     <question_title>Date of Audit</question_title> 
     <type>DateOfAudit</type> 
     <db_field_name>date_of_audit</db_field_name> 
     <additional_comment/> 
    </field> 
    <field required="Y" is_admin_field="N"> 
     <question_title>Name of Auditor</question_title> 
     <type>TextField</type> 
     <db_field_name>name_of_auditor</db_field_name> 
     <db_field_length>100</db_field_length> 
     <db_field_type>string</db_field_type> 
     <additional_comment/> 
    </field> 
    <field required="Y" is_admin_field="N"> 
     <question_title>Store Location</question_title> 
     <type>TextField</type> 
     <db_field_name>store_location</db_field_name> 
     <db_field_type>string</db_field_type> 
     <additional_comment/> 
    </field> 
    <field required="Y" is_admin_field="N"> 
     <question_title>Name of Staff</question_title> 
     <type>TextField</type> 
     <db_field_name>name_of_staff</db_field_name> 
     <db_field_length>100</db_field_length> 
     <db_field_type>string</db_field_type> 
     <additional_comment/> 
    </field> 
    <group name="Basic Service Skills"> 
     <section name="Greet" db_field_name="greet_score"> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Welcome customer with standard greeting</question_title> 
      <type>List</type> 
      <db_field_name>welcome_customer_with_standard_greeting_greet</db_field_name> 
      <options> 
      <item score="1" id="Welcome customer with standard greetingyes" extratext="N">Yes</item> 
      <item score="0" id="Welcome customer with standard greetingno" extratext="N">No</item> 
      </options> 
      <db_field_length>3</db_field_length> 
      <additional_comment/> 
     </field> 
     </section> 
     <section name="Service Interaction" db_field_name="service_interaction_score"> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Ask for customer's name politely</question_title> 
      <type>List</type> 
      <db_field_name> 
      ask_for_customers_name_politely_service_interaction 
      </db_field_name> 
      <options> 
      <item score="2" id="Ask for customer's name politelyyes" extratext="N">Yes</item> 
      <item score="0" id="Ask for customer's name politelyno" extratext="N">No</item> 
      <item score="2" id="Ask for customer's name politelyno with reason" extratext="Y" >No with reason</item> 

      </options> 
      <db_field_length>14</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Understand and meet customer's needs</question_title> 
      <type>List</type> 
      <db_field_name> 
      understand_and_meet_customers_needs_service_interaction 
      </db_field_name> 
      <options> 
      <item score="2" id="Understand and meet customer's needsyes" extratext="N">Yes</item> 
      <item score="0" id="Understand and meet customer's needsno" extratext="N">No</item> 
      </options> 
      <db_field_length>3</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Active listening</question_title> 
      <type>List</type> 
      <db_field_name>active_listening_service_interaction</db_field_name> 
      <options> 
      <item score="1" id="Active listeningyes" extratext="N">Yes</item> 
      <item score="0" id="Active listeningno" extratext="N">No</item> 
      </options> 
      <db_field_length>3</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Address customer by name</question_title> 
      <type>List</type> 
      <db_field_name>address_customer_by_name_service_interaction</db_field_name> 
      <options> 
      <item score="3" id="Address customer by nameyes" extratext="N">Good</item> 
      <item score="1" id="Address customer by nameavg" extratext="N">Avg</item> 
      <item score="0" id="Address customer by namepoor" extratext="N">Poor</item> 
      </options> 
      <db_field_length>4</db_field_length> 
      <additional_comment/> 
     </field> 
     </section> 
    </group> 
    <group name="Security/PDPA"> 
     <section name="Control" db_field_name="control_score"> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Verify customer's details when necessary</question_title> 
      <type>List</type> 
      <db_field_name>verify_customers_details_when_necessary_control</db_field_name> 
      <options> 
      <item score="2" id="Verify customer's details when necessaryyes" extratext="N">Yes</item> 
      <item score="0" id="Verify customer's details when necessaryno" extratext="N">No</item> 
      <item score="2" id="Verify customer's details when necessarynowithreason" extratext="Y">No with reason</item> 
      </options> 
      <db_field_length>14</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Display control over situation</question_title> 
      <type>List</type> 
      <db_field_name>display_control_over_situation_control</db_field_name> 
      <options> 
      <item score="1" id="xzcasd" extratext="N">Yes</item> 
      <item score="0" id="fshfusai" extratext="N">No</item> 
      <item score="1" id="gcvilhuf8" extratext="Y">No with reason</item> 
      </options> 
      <db_field_length>14</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Proactive in probing for more details</question_title> 
      <type>List</type> 
      <db_field_name>proactive_in_probing_for_more_details_control</db_field_name> 
      <options> 
      <item score="1" id="d8yfiwgdu" extratext="N">Yes</item> 
      <item score="0" id="sdjfisdgfs" extratext="N">No</item> 
      <item score="1" id="dsifyw" extratext="Y">No with reason</item> 
      </options> 
      <db_field_length>14</db_field_length> 
      <additional_comment/> 
     </field> 
     </section> 
     <section name="Closing" db_field_name="closing_score"> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Pre-closing</question_title> 
      <type>List</type> 
      <db_field_name>preclosing_closing</db_field_name> 
      <options> 
      <item score="1" id="sdfietr" extratext="N">Yes</item> 
      <item score="0" id="dfghvmdxsrw" extratext="N">No</item> 
      <item score="1" id="jnvswoeirytu" extratext="Y">No with reason</item> 
      </options> 
      <db_field_length>14</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Thank customer with standard greeting</question_title> 
      <type>List</type> 
      <db_field_name>thank_customer_with_standard_greeting_closing</db_field_name> 
      <options> 
      <item score="1" id="siyfh" extratext="N">Yes</item> 
      <item score="0" id=" jhvcb" extratext="N">No</item> 
      <item score="1" id="hgfcfdsg" extratext="Y">No with reason</item> 
      </options> 
      <db_field_length>14</db_field_length> 
      <additional_comment/> 
     </field> 
     </section> 
    </group> 
    <group name="Temporary Absence"> 
     <section name="Explain for Absence" db_field_name="explain_for_absence_score"> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Explain reason for temporary absence</question_title> 
      <type>List</type> 
      <db_field_name> 
      explain_reason_for_temporary_absence_explain_for_absence 
      </db_field_name> 
      <options> 
      <item score="3" id="dfihsvbiw" extratext="N">Good</item> 
      <item score="1" id="yufeigvb" extratext="N">Avg</item> 
      <item score="0" id="nfcjnvxiqeghe" extratext="N">Poor</item> 
      </options> 
      <db_field_length>4</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Thank customer for waiting upon return</question_title> 
      <type>List</type> 
      <db_field_name> 
      thank_customer_for_waiting_upon_return_explain_for_absence 
      </db_field_name> 
      <options> 
      <item score="3" id="fdssdfsdxcvx" extratext="N">Good</item> 
      <item score="1" id="sdfsfsdxvxbn" extratext="N">Avg</item> 
      <item score="0" id="fguydgfdsifdygfsbvxkvx" extratext="N">Poor</item> 
      </options> 
      <db_field_length>4</db_field_length> 
      <additional_comment/> 
     </field> 
     </section> 
     <section name="Transfer Techniques" db_field_name="transfer_techniques_score"> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Usher/direct customer when necessary</question_title> 
      <type>List</type> 
      <db_field_name> 
      usherdirect_customer_when_necessary_transfer_techniques 
      </db_field_name> 
      <options> 
      <item score="1" id="sdfusdhfusfhsfsfhsgsd" extratext="N">Yes</item> 
      <item score="0" id="euifhufdgafifort546" extratext="N">No</item> 
      <item score="1" id="dsufidhsfbvsao87866484" extratext="Y">No with reason</item> 
      </options> 
      <db_field_length>14</db_field_length> 
      <additional_comment/> 
     </field> 
     </section> 
    </group> 
    <group name="Impression"> 
     <section name="Essential Courtesies" db_field_name="essential_courtesies_score"> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Friendly and pleasant disposition</question_title> 
      <type>List</type> 
      <db_field_name> 
      friendly_and_pleasant_disposition_essential_courtesies 
      </db_field_name> 
      <options> 
      <item score="3" id="duiahsadhsidhaduiacbx" extratext="N">Good</item> 
      <item score="1" id="dfsfstrtw5432" extratext="N">Avg</item> 
      <item score="0" id="auidsheauhfiuaiuhae23422" extratext="N">Poor</item> 
      </options> 
      <db_field_length>4</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Eye contact/body language</question_title> 
      <type>List</type> 
      <db_field_name>eye_contact_body_language_essential_courtesies</db_field_name> 
      <options> 
      <item score="3" id="aduyigta7e8o7wqtr3q785tr387q" extratext="N">Good</item> 
      <item score="1" id="34242dsfgbvcsdfsbg" extratext="N">Avg</item> 
      <item score="0" id="uhrwerwh56484sfs6435" extratext="N">Poor</item> 
      </options> 
      <db_field_length>4</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Patience</question_title> 
      <type>List</type> 
      <db_field_name>patience_essential_courtesies</db_field_name> 
      <options> 
      <item score="3" id="sdf8iohfsoihohs54352342dfsf" extratext="N">Good</item> 
      <item score="1" id="ufishduheorq03291df5s64" extratext="N">Avg</item> 
      <item score="0" id="dsfidosjfdsifdshfspfs543242sda" extratext="N">Poor</item> 
      </options> 
      <db_field_length>4</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Display human touch</question_title> 
      <type>List</type> 
      <db_field_name>display_human_touch_essential_courtesies</db_field_name> 
      <options> 
      <item score="3" id="dsfiuysfhgoisduf9328473248937432984" extratext="N">Good</item> 
      <item score="1" id="audhasduahdadiua7324632" extratext="N">Avg</item> 
      <item score="0" id="uihfehrqueriqfgqe8942732" extratext="N">Poor</item> 
      </options> 
      <db_field_length>4</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Choice of words</question_title> 
      <type>List</type> 
      <db_field_name>choice_of_words_essential_courtesies</db_field_name> 
      <options> 
      <item score="3" id="duriyrweorewyr798wer" extratext="N">Good</item> 
      <item score="1" id="ewr7ew8rytwe87rewyt8742873432g38" extratext="N">Avg</item> 
      <item score="0" id="3894y242849y2hdsu9fdsh8" extratext="N">Poor</item> 
      </options> 
      <db_field_length>4</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Rate of speech/enunciation</question_title> 
      <type>List</type> 
      <db_field_name>rate_of_speech_enunciation_essential_courtesies</db_field_name> 
      <options> 
      <item score="3" id="uirhewurwb42342uibfds" extratext="N">Good</item> 
      <item score="1" id="ajdnadjahd9o7342" extratext="N">Avg</item> 
      <item score="0" id="ufdahdoisad9876983473" extratext="N">Poor</item> 
      </options> 
      <db_field_length>4</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Bad habits</question_title> 
      <type>List</type> 
      <db_field_name>bad_habits_essential_courtesies</db_field_name> 
      <options> 
      <item score="3" id="aoidajoidjaw4253453" extratext="N">Good</item> 
      <item score="1" id="erwoiuhwroiuwher9842" extratext="N">Avg</item> 
      <item score="0" id="ewrwihrewiurewr783432" extratext="N">Poor</item> 
      </options> 
      <db_field_length>4</db_field_length> 
      <additional_comment/> 
     </field> 
     </section> 
     <section name="Grooming" db_field_name="grooming_score"> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Well-groomed</question_title> 
      <type>List</type> 
      <db_field_name>wellgroomed_grooming</db_field_name> 
      <options> 
      <item score="3" id="duhdaosp898342424" extratext="N">Good</item> 
      <item score="1" id="aduhfuahbulhw432" extratext="N">Avg</item> 
      <item score="0" id="udfhaoiauhyy987132" extratext="N">Poor</item> 
      </options> 
      <db_field_length>4</db_field_length> 
      <additional_comment/> 
     </field> 
     </section> 
    </group> 
    <group name="Business Competency"> 
     <section name="Business Knowledge" db_field_name="business_knowledge_score"> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Give correct information for products or services</question_title> 
      <type>DropDownList</type> 
      <db_field_name> 
      give_correct_information_for_products_or_services_business_knowledge 
      </db_field_name> 
      <options> 
      <item score="2" id="aduoiahsiuh4968586458496514" extratext="N">Yes</item> 
      <item score="0" id="suihfsiufho7y467898" extratext="N">No</item> 
      </options> 
      <db_field_length>3</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N" gotCode="Y"> 
      <question_title>What programming language is used below?</question_title> 
      <codeQ> 
    correct information for products or services What programming language is used below? 
     </codeQ> 


      <type>List</type> 
      <db_field_name> 
      retrieve_relevant_information_efficiently_business_knowledge 
      </db_field_name> 
      <options> 
      <item score="2" id="aduhsadiuah33y9o2313213" extratext="N">Yes</item> 
      <item score="0" id="easdeqw412312" extratext="N">No</item> 
      </options> 
      <db_field_length>3</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Follow correct processes &amp; procedures</question_title> 
      <type>List</type> 
      <db_field_name> 
      follow_correct_processes_procedures_business_knowledge 
      </db_field_name> 
      <options> 
      <item score="2" id="eqeqwdasavcxx523423" extratext="N">Yes</item> 
      <item score="0" id="fdjfsoifjsoijoij7878787878785634543" extratext="N">No</item> 
      </options> 
      <db_field_length>3</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Update customer incident in system</question_title> 
      <type>List</type> 
      <db_field_name> 
      update_customer_incident_in_system_business_knowledge 
      </db_field_name> 
      <options> 
      <item score="2" id="dadsaudhaduahuirhewrhiewur3243243241231465452131" extratext="N">Yes</item> 
      <item score="0" id="dasbdaihgqiuhg4321313132131" extratext="N">No</item> 
      <item score="2" id="wsjbsajbjnvu5235234675464-=" extratext="Y">No with reason</item> 
      </options> 
      <db_field_length>14</db_field_length> 
      <additional_comment/> 
     </field> 
     </section> 
     <section name="Provide Solution" db_field_name="provide_solution_score"> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Offer alternatives when needed</question_title> 
      <type>List</type> 
      <db_field_name>offer_alternatives_when_needed_provide_solution</db_field_name> 
      <options> 
      <item score="1" id="asdadnbjnbvxxofi435435343" extratext="N">Yes</item> 
      <item score="0" id="idfjsoifjdofsjfojfsfjsdfsa;jxjvnbvc,mnbj" extratext="N">No</item> 
      <item score="1" id="sdlakda4564ad4a64w6e4wq5eq1eq" extratext="Y">No with reason</item> 
      </options> 
      <db_field_length>14</db_field_length> 
      <additional_comment/> 
     </field> 
     </section> 
     <section name="Upsell/Retention" db_field_name="upsell_retention_score"> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Upsell value-added services/upgrades</question_title> 
      <type>List</type> 
      <db_field_name> 
      upsell_valueadded_services_upgrades_upsell_retention 
      </db_field_name> 
      <options> 
      <item score="2" id="sad1sad3sa1da5sda15a1d6awe4q8e623" extratext="N">Yes</item> 
      <item score="0" id="dfdsfbhu34b2bw4b234" extratext="N">No</item> 
      <item score="2" id="4u32h432u4h24j24h24j24h2b424b" extratext="Y">No with reason</item> 
      </options> 
      <db_field_length>14</db_field_length> 
      <additional_comment/> 
     </field> 
     <field required="Y" is_admin_field="N"> 
      <question_title>Probe reasons for termination</question_title> 
      <type>MultiLineTextField</type> 
      <db_field_name>probe_reasons_for_termination_upsell_retention</db_field_name> 

      <db_field_length>14</db_field_length> 
      <additional_comment/> 
     </field> 
     </section> 
     <section name="Resolution" db_field_name="resolution_score"> 
     <field required="N" is_admin_field="N"> 
      <question_title>First contact resolution</question_title> 
      <type>MultiList</type> 
      <db_field_name>first_contact_resolution_resolution</db_field_name> 
      <options> 
      <item score="2" id="b44b234j23bjdf9u9807" extratext="N">Yes</item> 
      <item score="0" id="jbfejwbj53j423b4j2b5" extratext="N">No</item> 
      <item score="2" id="ewjrhwueh6u235h234bjbr23242" extratext="Y">No with reason</item> 
      </options> 
      <db_field_length>14</db_field_length> 
      <additional_comment/> 
     </field> 
     </section> 
    </group> 
    <group name="Rate This Form!"> 
     <field is_admin_field="N" required="Y"> 
     <question_title>How would you rate this form?</question_title> 
     <type>Drop</type> 
     <db_field_name>How_would_you_rate_this_form_?</db_field_name> 
     </field> 
     <db_field_length>8</db_field_length> 
     <additional_comment/> 
    </group> 
    <fail marks="5"/> 
    <pass marks="10"/> 
    <great marks="15"/> 
    </fieldset> 
</form> 
+0

ファーストをチェックしてしまった私のjqueryのコードについては、私がいることを確実に動的に

<div id="controldiv"> </div> 

作成しようとしている私のdiv要素でありますダイナミックコントロールは特定のdivにのみ作成されます。 jqueryを使用して、私はこのdiv内のすべてのコントロールを取得し、それらを処理するコードを記述した型に基づいています。 –

答えて

0

最初に、ダイナミックコントロールが特定のdivにのみ作成されるようにしました。 jqueryを使用して、私はこのdiv内のすべてのコントロールを取得し、それらを処理するコードを記述した型に基づいています。

これは、すべてのコントロールは、私は、各コントロールが作成され、その種類

function getval() 
{ 
    var inputs = $("#controldiv input"); 
    inputs.each(function() { 
    if (this.type == "text"){ 
     //get textbox val here 
    } 
     else if (this.type == "checkbox"){ 
     // get val here 
    } 
    }); 
} 
+0

ここからどうやって進むのですか? – Wasd

+0

バックエンドにajax経由で値を送信 –

+0

javascriptまたはjqueryとajaxを使用せずにバックエンドに動的に作成されたコントロールの値を取得することはできません –

関連する問題