We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 47717
    • 144 Posts
    Hi,

    - I have a MIGX TV, with each : "naam" and "datum"

    - I call it with this code

    		[[!getImageList?
    		&tvname=`opleiding_events`
    		&tpl=`opleiding_events_TPL`
    		]]


    - the opleiding_events_TPL is hereunder, which contains one form. So for each MIGX item, another form on the same page is created.

    Now with this code, the Migx generated forms can be submitted, IF they are filled in correctly with all required values.

    - the problem :

    I can't get each "Form" to work seperately from each other, as they are all on one page.
    So when I fill out a "wrong value" on one form, I get that error-message value in all generated forms on the same page.

    I used a special "submitvar[[+idx]], so to target only one form, but it only doesn't work when outputted by Migx. On other pages when I use two forms, this error message with multiple forms works.

    I tried &placeholderPrefix=`opl[[+idx]]` , and changing all the "fi" in the code to "opl[[+idx]]", but then the forms do nothing at all.


    Help please :s !!


    <div class="content-wrap">
              <h4>[[+naam]]</h4>
              <div class="opleiding-text-para">
    [[+beschrijving]]
                <p><strong>Datum: [[+datum]]</strong></p>
                <p><a href="javascript:void(0)" class="btn opleiding-btn opleiding-btn[[+idx]]"> INSCHRIJVEN</a></p>
              </div>
    
    		  <div class="opleiding-text-form opleiding-text-form[[+idx]]">
                <h4>INSCHRIJVEN </h4>
    
    <!--- xxxxxxxxxxxx FORM CODE xxxxxxxxxxxxxxx -->
    [[!FormIt?
    &hooks=`spam,email,redirect,FormSave`
    &fsFormTopic=`inschrijving [[+naam]] [[+datum]]`
    &fsFormFields=`name,email,telephone,adres,message`
    &emailTpl=`opleiding_email_TPL`
    &emailFrom=`[email protected]`
    &emailTo=`[[+email[[+idx]]]]`
    &emailBCC=`[email protected]`
    &emailSubject=`->[[+opleiding]] `
    &validationErrorMessage = `Graag enkele correcties in het formulier aanbrengen aub.`
    &redirectTo=`79`
    &validate=`
    name:required,
    email:email:required,
    adres:required,
    telephone:required`
    &name.vTextRequired= `Geef aub uw naam in.`
    &email.vTextRequired= `Geef aub uw email in.`
    &adres.vTextRequired= `Geef aub uw adres in.`
    &telephone.vTextRequired= `Geef aub uw telefoonnummer in.`
    &submitVar=`submit[[+idx]]`
    ]]
    
    [[!+fi.validation_error_message:notempty=`
    <p style="color: red;">[[!+fi.validation_error_message]]</p>
    `]]
    
    			<form name="opleiding-form[[+idx]]" action="[[~[[*id]]]]" id="opleiding-form[[+idx]]" method="post" class="form" role="form">
    			<input type="hidden" name="nospam:blank" value="[[+fi.nospam]]" />
    
                  <div class="col-sm-12">
                    <div class="form-group">
    					<textarea name="opleiding" id="opleiding" class="form-control" rows="1" 
    				  placeholder="opleiding"  value="[[+fi.opleiding]]" readonly>
    Ik schrijf me in voor de opleiding  [[+naam]]  op datum van  [[+datum]] 
    				  	</textarea>
                    </div>
                  </div>
    
                  <div class="col-sm-6" >
                    <div class="form-group">
                      <label class="sr-only" for="name">Naam* <span class="error">[[!+fi.error.name]]</span></label>
                      <input type="text" class="form-control" id="name" name="name" placeholder="naam*" value="[[+fi.name]]" >
                    </div>
                  </div>	
    
    
                  <div class="col-sm-6" >
                    <div class="form-group">
                      <label class="sr-only" for="email">E-mail* <span class="error">[[!+fi.error.email]]</span></label>
                      <input type="text" class="form-control" id="email" name="email" placeholder="e-mailadres*" value="[[+fi.email]]">
                    </div>
                  </div>
    
    
                  <div class="col-sm-6" >
                    <div class="form-group">
                      <label class="sr-only" for="adres">adres* <span class="error">[[!+fi.error.adres]]</span></label>
                      <input type="text" class="form-control" id="adres" name="adres" placeholder="adres*"  value="[[+fi.adres]]">
                    </div>
                  </div>
    
    
                  <div class="col-sm-6" >
                    <div class="form-group">
                      <label class="sr-only" for="telephone">Telefoon* <span class="error">[[!+fi.error.telephone]]</span></label>
                      <input type="text" class="form-control" id="telephone" name="telephone"  maxlength="10" placeholder="telefoonnummer*"  value="[[+fi.telephone]]">
                    </div>
                  </div>
    
    
                  <div class="col-sm-12" >
                    <div class="form-group">
                      <label for="message" class="sr-only">boodschap <span class="error">[[!+fi.error.message]]</span></label>
                      <textarea name="message" id="message" class="form-control" rows="6" 
    				  placeholder="boodschap"  value="[[+fi.message]]"></textarea>
                    </div>
                  </div>
                  <div class="col-sm-12" >
                    <button type="submit" name="submit[[+idx]]" value=" " class="btn btn-opleiding-form ">VERZENDEN</button>
                  </div>
                </form>
              </div>
            </div>
    

    [ed. note: sriananda last edited this post 7 years, 5 months ago.]