Osclass Support Forums
Osclass theme support => Veronika Osclass Responsive Theme => Topic started by: njsb777 on May 02, 2017, 12:48:03 AM
-
How can I place transaction and condition fields as required fields? When registering a new ad.
-
@njsb
In item-post.php you need to add code in section:
$("form[name=item]").validate({
with ID of input you want to be required (check existing codes here to find pattern).
-
Add the following codes, but it does not work. Can you help me? I do not have much knowledge in php.
<?php if(strpos($required_fields, 'Transaction') !== false) { ?>
Transaction: {
required: true
},
<?php } ?>
"Transaction[<?php echo osc_current_user_locale(); ?>]": {
required: "<?php echo osc_esc_js(__('Transaction: this field is required.', 'veronika')); ?>",
minlength: "<?php echo osc_esc_js(__('Transaction: select transaction from transaction field.', 'veronika')); ?>"
},
-
example for Transaction
in item-post.php
1. where you have
$("form[name=item]").validate({
add:
<?php if(strpos($required_fields, 'transaction') !== false) { ?>
sTransaction: {
required: true
},
<?php } ?>
2. where you have
messages: {
add:
<?php if(strpos($required_fields, 'transaction') !== false) { ?>
sTransaction: {
required: "<?php echo osc_esc_js(__('Transaction: this field is required.', 'veronika')); ?>"
},
<?php } ?>
3. in admin panel in Required Fields on Publish add world transaction
etc.....
-
@Ivanko
wooow... Thank you very much, that's what I needed.
It worked perfectly!
-
example for Transaction
in item-post.php
1. where you have
$("form[name=item]").validate({
add:
<?php if(strpos($required_fields, 'transaction') !== false) { ?>
sTransaction: {
required: true
},
<?php } ?>
2. where you have
messages: {
add:
<?php if(strpos($required_fields, 'transaction') !== false) { ?>
sTransaction: {
required: "<?php echo osc_esc_js(__('Transaction: this field is required.', 'veronika')); ?>"
},
<?php } ?>
3. in admin panel in Required Fields on Publish add world transaction
etc.....
Ivanko,
Can you write in more detail what we do in step 3?
-
@kriskoyk
You go to theme settings and in input "Required fields on publish" write "transaction" as well
-
The issue has been resolved.
-
example for Transaction
in item-post.php
1. where you have
$("form[name=item]").validate({
add:
<?php if(strpos($required_fields, 'transaction') !== false) { ?>
sTransaction: {
required: true
},
<?php } ?>
2. where you have
messages: {
add:
<?php if(strpos($required_fields, 'transaction') !== false) { ?>
sTransaction: {
required: "<?php echo osc_esc_js(__('Transaction: this field is required.', 'veronika')); ?>"
},
<?php } ?>
3. in admin panel in Required Fields on Publish add world transaction
etc.....
Is it possible to do the same with images?
can you provide code?