ow to i have validation for each input for it’s own not just one <p> containing all errors?
like
<label>becomes red on validation fail
<input>
<span>error message + turn visible after validation fail
<input name="email" id="cfEmail" class="text" type="text" eform="Email Address:email:1" />
as i see on eform parameter i can enter
[name which i have no idea what for and where it used] : [validations type, which is clear to me] : [validations on or off] : [custom validations message i want to appear at <span> as above]
at "ContactFormReport" chunk the values at [+?+] ie. [+subject+] are taken from input’s name parameter?
also is there any connection between the way i receive the massage from my site by email and this form? if not is there a way i can customize the way i receive a message
&to=`` set to [(email_sender)] which means...? i’ve seen ppl changing it to their own email should i do the same?
still needs an answer about inline error messages, it must a way. TobyL is too eFormed to miss that functionality.
i meant to customize email would be sent but silly me.
default "ContactFormReport" is the way i receive an email ...
so [(email_sender)] default email i set via manager>tools>configuration>User or during MODx installation as admin email?
still needs an answer about inline error messages, it must a way. TobyL is too eFormed to miss that functionality.Thanks for the compliment
but no there is no inbuilt functionality for individual error messages. In most cases this is not needed and it’s impossible to cater for every need and circumstance. For the required messages you could use the eFormOnValidate event and write your own solution, but this is much more difficult for other validation messages as these messages are not stored with a reference to the input field.action="[~[*id*]~]"
<form method="post" action="[~[*id*]~]" id="EmailForm" name="EmailForm">
<fieldset>
<input name="formid" type="hidden" value="ContactForm" />
<h5 class="formError">[+validationmessage+]</h5>
<label for="cfCompanyname">Company Name :</label>
<input name="company" id="cfCompanyname" type="text" eform="Company Name::1" /><br />
<label for="cfYourname">Your Name :</label>
<input name="name" id="cfYourname" type="text" eform="Your Name::1" /><br />
<label for="cfYoursite">Your Website Address :</label>
<input name="site" id="cfYoursite" type="text" eform="Your Website::1" /><br />
<label for="cfEmail">Your Email Address :</label>
<input name="email" id="cfEmail" type="text" eform="Email Address:email:1" /><br />
<label for="cfRegarding">Your Request :</label>
<select name="subject" id="cfRegarding" eform="Your Request::1">
<option value="x">x</option>
<option value="y">y</option>
<option value="z">z</option>
<option value="v">v</option>
<option value="other">other</option>
</select><br />
<label for="cfMessage">Additional Information :</label>
<textarea name="message" id="cfMessage" rows="10" cols="20" eform="Additional Information:textarea:1"></textarea><br />
<label></label>
<input type="submit" name="contact" id="cfContact" value="send it to us" />
</fieldset>
</form><p>This is a response sent by <b>[+name+]</b></p> <p>Company Name:<br />[+company+]</p> <p>Name:<br />[+name+]</p> <p>Website:<br />[+site+]</p> <p>Email:<br />[+email+]</p> <p>Request :<br />[+subject+]</p> <p>Additional Information :<br />[+message+]</p>
cool validation, i think it would be better to implement it rather having validation checks though php. especially when prototype included within modx as far as i know.
just to be sure do i need to set form’s action toif the validation passes via Javascript?action="[~[*id*]~]"
TobyL, i come from accessibility point of web. when there are inputs and there is an error the incorrect input should be highlighted whether it’s a red star near by, border of input becomes red or label text it doesn’t matter but input should be incorrect highlighted.
hopefully you will implement that in next version like having boolean eform parameter whether to highlight or not, could be even better to trigger input, label of input or span near input out of user’s choice.