Как вернуть соответствующее значение в множественном выборе формы?

0

Я создаю страницу обратной связи, которая просит пользователя выбрать, как они себя чувствуют в отношении их обучения. Они могут оценивать обслуживание как "Отлично", "Хорошо" или "Плохо". Я видел некоторые подобные вопросы, которые касаются только если что-то было проверено, и в этом случае было сказано объявить явное значение. который, я думаю, мог бы работать для ответа "да". Но как насчет того, когда у вас есть несколько вариантов?

Не знаю, где мой скрипт VB неправильно.

отправители /training_feedback_send.asp

<html>
<head>
<%
Sub ProcessContact
  Response.Buffer = true    
  dim gRating, gTrainerKnowledgeable, gNotKnowl, gTrainingExperience, gTrainingMaterials, gRateUI, gTs150Perform, gTs150NonPerformReason, gRestorationsAttempted, gRestorationsSuccessful, gRestorationsUnsuccessful, gFeatureChange, gFutureUpdates, gPurchasingMotivation, gAdditionalQuestions, gContactRequest, gFullName, gEmail

  gRating = Request.Form("Rating")
  gTrainerKnowledgeable = Request.Form("TrainerKnowledgeable")
  gNotKnowl = Request.Form("gNotKnowl")
  gTrainingExperience = Request.Form("TrainingExperience")
  gTrainingMaterials = Request.Form("TrainingMaterials")    
  gRateUI = Request.Form("RateUI")
  gTs150Perform = Request.Form("Ts150Perform")
  gTs150NonPerformReason = Request.Form("Ts150Perform")
  gRestorationsAttempted = Request.Form("RestorationsAttempted")
  gRestorationsSuccessful = Request.Form("RestorationsSuccessful")
  gRestorationsUnsuccessful = Request.Form("RestorationsUnsuccessful")  
  gFeatureChange = Request.Form("FeatureChange")
  gFutureUpdates = Request.Form("FutureUpdates")
  gPurchasingMotivation = Request.Form("PurchasingMotivation")
  gAdditionalQuestions = Request.Form("AdditionalQuestions")
  gContactRequest = Request.Form("ContactRequest")

  gFullName = Request.Form("FullName")
  gEmailAddress = Request.Form("EmailAddress")


  msg = msg & "How would you rate the overall effectiveness of the on-site training?: " & gRating & chr(10)& chr(13)

  msg = msg & "Did you feel that the trainer was knowledgeable on the product and answered your questions to your satisfaction? If not, explain why: " & gTrainerKnowledgeable & chr(10)& chr(13)

  msg = msg & "Did you feel that the trainer was knowledgeable on the product and answered your questions to your satisfaction? If not, explain why: " & gNotKnowl & chr(10)& chr(13)

  msg = msg & "How would you rate your training experience on a scale of 1 - 5, where 1 is poor and 5 is excellent?: " & gTrainingExperience & chr(10)& chr(13)

  msg = msg & "Do you find the published training materials helpful?(quickstart guide, tutorials, etc.): " & gTrainingMaterials & chr(10)& chr(13)

  msg = msg & "How would you rate the user interface (GUI) in terms of ease of use and clarity of information?: " & gRateUI& chr(10)& chr(13)

  msg = msg & "Does the TS-150 perform as you anticipated? " & gTs150Perform & chr(10)& chr(13) 

  msg = msg & "If not, in what way is the performance different?: " & gTs150NonPerformReason & chr(10)& chr(13) 

  msg = msg & "How many restorations have you attempted?: " & gRestorationsAttempted & chr(10)& chr(13)

  msg = msg & "How many were successful?: " & gRestorationsSuccessful & chr(10)& chr(13)

  msg = msg & "Please describe the problems on any unsuccessful restorations. For example, did they fail to mill? Did they not seat well? Were there problems with the material?: " & gRestorationsUnsuccessful & chr(10)& chr(13)

  msg = msg & "Are there any features of the TS150 that you would change? If so what would they be?: " & gFeatureChange & chr(10)& chr(13)

  msg = msg & "What features would you like to see in future updates to the design software and mill software?: " & gFutureUpdates & chr(10)& chr(13)

  msg = msg & "What was your primary motivation for purchasing IOS products?: " & gPurchasingMotivation & chr(10)& chr(13)

  msg = msg & "Do you have additional questions or would you like additional training?: " & gAdditionalQuestions & chr(10)& chr(13)

  msg = msg & "Would you like to be contacted as a follow-up to this survey?: " & gContactRequest & chr(10)& chr(13)

  msg = msg & "Full Name: " & gFullName & chr(10)& chr(13)
  msg = msg & "Email Address: " & gEmailAddress & chr(10)& chr(13)

страниц/учебно-feedback.aspx

<form action="/mailers/training_feedback_send.asp" method="post" name="Form1" id="trainingFeedback">
  <fieldset>
      <legend>Training and Product Feedback</legend>

        <div class="row">

          <div class="twelve columns">
            <label>How would you rate the overall effectiveness of the on-site training?</label>
            <input type="radio" name="Rating" value="Excellent">Excellent<br>
            <input type="radio" name="Rating" value="Good">Good<br>
            <input type="radio" name="Rating" value="Poor">Poor<br>
          </div>

          <div class="twelve columns">
            <label>Did you feel that the trainer was knowledgeable on the product and answered your questions to your satisfaction? 
            <br>If not, explain why.</label>
            <input type="radio" name="TrainerKnowledgeable" value="yes"><span>Yes</span>
            <input type="radio" name="TrainerKnowledgeable" value="no"><span>No</span>
            <textarea id="gNotKnowl" name="gNotKnowl" class="twoLines" rows="2" placeholder="reason"></textarea>
          </div>
  • 3
    В качестве дополнительного примечания: если вы предоставляете своим пользователям 3 варианта выбора - от хорошего до плохого, я бы порекомендовал сделать средний звук более нейтральным, например, «Отлично», «Удовлетворительно», «Плохо». Выбор Отлично / Хорошо / Плохо пристрастен.
  • 1
    1. Вопрос «да / нет» тоже должен быть переключателем, а не флажком (вы не можете одновременно отвечать «да» и «нет»). 2. Сценарий обработки формы запрашивает поле с именем «TrainerKnowledgeable», но в форме такого поля нет - флажки называются «checkbox1» и «checkbox2».
Показать ещё 3 комментария
Теги:
asp-classic
vbscript
contact-form

2 ответа

0
Лучший ответ

С моим оригинальным вопросом было много проблем. Поскольку существует множество вариантов выбора, в которые может быть только один выбор, необходимо изменить <input type="checkbox" на <input type="radio". Необходимо было объявить значение, и я дал каждому варианту id (хотя это и не обязательно). Вот что прошло успешно

страниц/учебно-feedback.aspx

<input type="radio" name="Rating" id="RatingE" value="Excellent">Excellent<br>
<input type="radio" name="Rating" id="RatingG" value="Good">Good<br>
<input type="radio" name="Rating" id="RatingP" value="Poor">Poor<br>


В моем файле .asp я добавил следующее

отправители /training_feedback_send.asp

dim gRating

gRating = Request.Form("Rating")

msg = msg & "How would you rate the overall effectiveness of the on-site training?: " & gRating & chr(10)& chr(13)


Вот что я получил в своем письме

Изображение 174551


Вышеупомянутый должен обратиться к любому, кто пытается что-то подобное. Однако следует отметить, что в отношении "ошибки сервера", которую я получал. Это было из-за того, как я объявил переменную для получения электронной почты в моем файле .asp. После жесткого кодирования переменной не было проблем.

objCDO.From = "[email protected]"

И вот что теперь появляется в поле "from". Вы можете настроить свой собственный адрес электронной почты в соответствии с вашими потребностями. Но я бы предложил дециптическое имя, например [email protected]

Над моим жестко закодированным письмом я добавил следующее

msg = msg & "Email Address: " & gEmailAddress & chr(10)& chr(13)

из-за того, что моя форма собрала электронное письмо от посетителя сайта. Точно так же вы можете это сделать. Я ранее допустил ошибку:

objCDO.From = gEmailAddress

Это вызвало ошибку, если это поле было пустым. Это может быть проблемой, если у вас есть проверка формы. Но в нашем случае менеджер проекта хотел, чтобы все поля были полностью необязательными.

2

Вместо использования <input type="checkbox"> используйте тип входа Radio Button:

<input type="radio" name="Rating" value="Excellent" checked>Excellent<br>
<input type="radio" name="Rating" value="Good">Good<br>
<input type="radio" name="Rating" value="Poor">Poor<br>

Изменить: я добавил атрибут checked. Из приведенной выше ссылки:

Для некоторых браузеров всегда требуется один переключатель в группе. Чтобы обеспечить правильный выбор по умолчанию, авторы могут пожелать определить один из элементов радио INPUT как CHECKED.

  • 0
    Спасибо, я это реализовал. И попытался настроить VBScript, но, похоже, все еще чего-то не хватает в этой части
  • 0
    Хммм, см. Тему Радио-кнопки на HTML-формах в W3Schools. Вы видите переключатели в браузере?
Показать ещё 4 комментария

Ещё вопросы

Сообщество Overcoder
Наверх
Меню