1

[Noob question] I'm using contact form 7 from Wordpress. I have 2 inputs which I have to return post_title and price for event :

if (window.location.href.indexOf("event") > -1) {
  var titre = $('.entry-title').text();
  var prix = $('.ai1ec-cost .ai1ec-field-value').text();

  $('.ghost input').prop('disabled', true);
  $('.ghost input').attr('value', titre);
  $('.ghost input').val(titre);

  $('.ghostPrice input').prop('disabled', true);
  $('.ghostPrice input').val(prix);

}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form action="/event/pause-cafe-des-parents/?instance_id=35#wpcf7-f1623-o1" method="post" class="wpcf7-form" novalidate="novalidate">
  <label class="ghost"> Nom de l'événement<br>
    <span class="wpcf7-form-control-wrap evenement">
      <input name="evenement" value="la pause-café" size="40" class="wpcf7-form-control wpcf7-text" aria-invalid="false" disabled="" type="text">
    </span>
  </label>
  <label class="ghostPrice"> Prix de l'événement<br>
    <i>Les modalités de paiements seront présents dans l'e-mail de confirmation</i><br>
    <span class="wpcf7-form-control-wrap price">
      <input name="price" value="" size="40" class="wpcf7-form-control wpcf7-text" aria-invalid="false" disabled="" type="text">
    </span>
  </label>
  <p>
     <input value="Envoyer" class="wpcf7-form-control wpcf7-submit" type="submit"><span class="ajax-loader"></span>
  </p>
</form>

My input return my value correctly but when I submit my form, this value not returned.

If I type in my input (like normal form), my value is returned.

Any idea ?

4
  • 1
    ghostPrice, where is it? Commented Oct 2, 2017 at 11:01
  • There are a few details missing in the questions like inputs you are using and where you are submitting the form. Commented Oct 2, 2017 at 11:02
  • @Roamer-1888 ghost price is like the another label :) (same but only class change) Commented Oct 2, 2017 at 11:29
  • @bhansa Post edited Commented Oct 2, 2017 at 11:34

2 Answers 2

2

I just removed "disabled" and add "hide" and it works.

Sign up to request clarification or add additional context in comments.

Comments

0

Remove disabled attribute from the inputs

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.