1

I have created a form

<form class="form" action="<?= $block->getUrl('interestbeat/user/post',['_secure' => $this->getRequest()->isSecure()]) ?>);" method="post" enctype="multipart/form-data">
<fieldset class="fieldset">
    <legend class="legend"><span><?php /* @escapeNotVerified */ echo __('Test Form') ?></span></legend><br>
    <div class="field required">
        <label for="number" class="label"><span><?php /* @escapeNotVerified */ echo __('First name') ?></span></label>
        <div class="control">
            <input type="text" id="first_name" name="first_name" class="input-text" required="true"/>
        </div>
    </div>
    <div class="field required">
        <label for="number" class="label"><span><?php /* @escapeNotVerified */ echo __('Last-Name') ?></span></label>
        <div class="control">
            <input type="text" id="last_name" name="last_name" class="input-text"/>
        </div>
    </div>
    <div class="field required">
        <label for="email" class="label"><span><?php /* @escapeNotVerified */ echo __('Email') ?></span></label>
        <div class="control">
            <input type="email" id="email" name="email" class="input-text"/>
        </div>
    </div>
    <div class="field required">
        <label for="phonenumber" class="label"><span><?php /* @escapeNotVerified */ echo __('Phone Number') ?></span></label>
        <div class="control">
            <input type="number" id="phonenumber" name="phonenumber" class="input-text"/>
        </div>
    </div>
    <div class="field required">
        <label for="accountnumber" class="label"><span><?php /* @escapeNotVerified */ echo __('Account Number') ?></span></label>
        <div class="control">
            <input type="number" id="account_number" name="account_number" class="input-text"/>
        </div>
    </div>
    <div class="field required">
        <label for="invoicenumber" class="label"><span><?php /* @escapeNotVerified */ echo __('Invoice Number') ?></span></label>
        <div class="control">
            <input type="number" id="invoice_number" name="invoice_number" class="input-text"/>
        </div>
    </div>


        <label for="producklink" class="label"><span><?php /* @escapeNotVerified */ echo __('Product Link') ?></span></label>
        <div class="control">
            <input type="url" id="product_url" name="product_url" class="input-text"/>
        </div>


      <label for="productimage" class="label"><span><?php /* @escapeNotVerified */ echo __('Product image') ?></span></label>
      <div class="control">
        <input type="file" name="upload_file" class="input-text"/>
      </div>

<div class="actions-toolbar">
    <div class="primary">
        <button type="submit" class="action submit primary" title="<?php /* @escapeNotVerified */ echo __('Submit') ?>">
            <span><?php /* @escapeNotVerified */ echo __('Submit') ?></span>
        </button>
    </div>
</div>
 </form>

how to make last two field as optional.one of the two is a required one enter image description here

these are the fields. i'm just showing an example image above

<label for="producklink" class="label"><span><?php /* @escapeNotVerified */ echo __('Product Link') ?></span></label>
    <div class="control">
        <input type="url" id="product_url" name="product_url" class="input-text"/>
    </div>


  <label for="productimage" class="label"><span><?php /* @escapeNotVerified */ echo __('Product image') ?></span></label>
  <div class="control">
    <input type="file" name="upload_file" class="input-text"/>
  </div>
  • where is image form code? because i can't able to see Competitor's product link in your from code – Rutvee Sojitra Sep 20 '18 at 12:30
  • I have mentioned the fields separately in the question – Nismath vi Sep 20 '18 at 12:33
  • do you want, any one field must fill by customer, right? – Dhiren Vasoya Sep 20 '18 at 14:04
  • yes i want like that – Nismath vi Sep 20 '18 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.