This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

njsb777

  • ***
  • 26 posts
How can I place transaction and condition fields as required fields? When registering a new ad.
« Last Edit: May 03, 2017, 07:21:05 PM by njsb777 »

*

MB Themes

@njsb
In item-post.php you need to add code in section:
Code: [Select]
$("form[name=item]").validate({
with ID of input you want to be required (check existing codes here to find pattern).
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

njsb777

  • ***
  • 26 posts
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')); ?>"
},

Marked as best answer by frosticek on May 04, 2017, 09:32:54 AM
*

Ivanko

  • *****
  • 388 posts
example for Transaction

in item-post.php

1. where you have
Code: [Select]
$("form[name=item]").validate({add:
Code: [Select]
<?php if(strpos($required_fields'transaction') !== false) { ?>
           sTransaction: {
            required: true
          },
           <?php ?>

2. where you have
Code: [Select]
messages: {add:
Code: [Select]
<?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.....
« Last Edit: May 03, 2017, 09:25:04 PM by Ivanko »

*

njsb777

  • ***
  • 26 posts
@Ivanko

wooow... Thank you very much, that's what I needed.

It worked perfectly!

*

kriskoyk

  • *****
  • 270 posts
example for Transaction

in item-post.php

1. where you have
Code: [Select]
$("form[name=item]").validate({add:
Code: [Select]
<?php if(strpos($required_fields'transaction') !== false) { ?>
           sTransaction: {
            required: true
          },
           <?php ?>

2. where you have
Code: [Select]
messages: {add:
Code: [Select]
<?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?


*

MB Themes

@kriskoyk
You go to theme settings and in input "Required fields on publish" write "transaction" as well
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

kriskoyk

  • *****
  • 270 posts
The issue has been resolved.

*

officela

  • ***
  • 64 posts
example for Transaction

in item-post.php

1. where you have
Code: [Select]
$("form[name=item]").validate({add:
Code: [Select]
<?php if(strpos($required_fields'transaction') !== false) { ?>
           sTransaction: {
            required: true
          },
           <?php ?>

2. where you have
Code: [Select]
messages: {add:
Code: [Select]
<?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?