More one thing. I were testing some function like this:
if($fields['somefield1'] == 'something'){
$fields['somefield2'] = 'newthing';
}
The variable was changed but it’s not showing in the form. How could I do this?
Thank you a lot.
Pablo
You can’t validate the form fields prior to the button being clicked using the plugin (as you described). If you want that type of validation, you’d need to write (and load) some client side javascript to handle it.
You can, however, add your own custom validation to the form upon submission. Using the wpmem_pre_register_data action hook, if you validate whatever field you want (or multiple fields), if the data doesn’t meet whatever criteria, set a value for $wpmem_themsg as the error message.
http://rocketgeek.com/wp-members-users-guide/filter-hooks/wpmem_pre_register_data/
The second thing you asked – setting a value of something based on another field’s value – can be done filtering the posted form results with wpmem_register_data:
http://rocketgeek.com/plugins/wp-members/docs/filter-hooks/wpmem_register_data/
Hi, I need to do a extra button that it validate one field and other thing. I have a function that do this but the way that i call it conflicts with the form.
I’m use it:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js" ></script>
<script type="text/javascript" src="http://(WebSite).com/ajax.js" ></script>
And I used “ajax” to call the php file to do the validation by the extra button.
How can I call this function without conflicts with the form?
If you can tell me how I can put the extra button beside a field it’ll help very much too.
Thank you for all help until now.
Pablo
-
This reply was modified 9 years, 9 months ago by
pablow3v.
One more thing, when I don’t fill a required field, when I press the button to register a mensagem is shown to fill all required field.
I want to call a validation before it call that message. The “wpmem_pre_validate_form” is called after this message.
How could I call it before?
Have a good day and thanks very much.
Pablo
One more thing, when I don’t fill a required field, when I press the button to register a mensagem is shown to fill all required field.
I want to call a validation before it call that message. The “wpmem_pre_validate_form” is called after this message.
The plugin’s HTML for the forms uses HTML5. HTML5 has automatic form validation built in. So if a field is marked as required, you will receive a message right away. That’s the message you are talking about. HTML5 validation happens before any submit event, in all browsers, so it’s not possible to do anything prior to that.