Jump to content
mariesnejstrup

Hjælp til at undgå error i oprettelse

Recommended Posts

Hej! 

 

Jeg sidder med en udfordring, fordi jeg skal lave nogle specifikke "oprettelse af konto" informationer.

 

Når mine B2B ønsker at oprette sig, skal jeg bruge følgende oplysninger:

 

Firma navn

Adresse

Land

Mail

Telefonnummer

CVR

 

 

Jeg har udkommenteret de felter jeg ikke skulle bruge og så har jeg ændret fx. mobile number til cvr nummer inde i oversættelse. 

Det står som det skal nu, men jeg får nogle errors! :

 

There are 7 errors

  1. lastname is required.
  2. id_country is required.
  3. company is required.
  4. postcode is required.
  5. city is required.
  6. Country cannot be loaded with address->id_country
  7. Country is invalid

 

Hvordan undgår jeg disse errors? Og hvad ville være det optimale at gøre?

post-825990-0-65130500-1415261312_thumb.png

Share this post


Link to post
Share on other sites

Sådan her fx:

 

<input type="hidden" name="lastname" id="lastname" value="{if isset($smarty.post.lastname)}{$smarty.post.lastname}{/if}" />
                    <div class="form-group">
<label for="lastname">{l s='Last name'} <sup>*</sup></label>
<input type="text" class="is_required validate form-control" data-validate="isName" id="lastname" name="lastname" value="{if isset($smarty.post.lastname)}{$smarty.post.lastname}{/if}" />

Share this post


Link to post
Share on other sites

Hvis du stadig får fejl om at den skal udfyldes, så er det fordi dit skjulte felt er tomt, test med at sætte noget fast ind i, altså value="test" og se om fejlen forsvinder.

Share this post


Link to post
Share on other sites

Får disse fejl stadig:


 


There are 2 errors


  1. company is required.
  2. lastname is required.

Har sat dette ind: 


 


   <input type="hidden" name="lastname" id="lastname" value="test" />


                    <div class="form-group">

<div class="form-group">

<label for="customer_lastname">{l s='Last name'} <sup>*</sup></label>

<input onkeyup="$('#lastname').val(this.value);" type="text" class="is_required validate form-control" data-validate="isName" id="customer_lastname" name="customer_lastname" value="{if isset($smarty.post.customer_lastname)}{$smarty.post.customer_lastname}{/if}" />

</div> 

Share this post


Link to post
Share on other sites

Meningen var at du ville "fjerne" lastname m.m. som jeg forstod det.

 

Dit problem er at ligenu har du to lastname felter. Hvis du laver et hidden input felt så kan du fjerne alt det andet:

 

<div class="form-group">
<div class="form-group">
<label for="customer_lastname">{l s='Last name'} <sup>*</sup></label>
<input onkeyup="$('#lastname').val(this.value);" type="text" class="is_required validate form-control" data-validate="isName" id="customer_lastname" name="customer_lastname" value="{if isset($smarty.post.customer_lastname)}{$smarty.post.customer_lastname}{/if}" />
</div> 

Share this post


Link to post
Share on other sites
Og jeg skal bare gøre det samme ved company?

 

 


{if $field_name eq "company"}

{if !$b2b_enable}

                        

<input type="hidden" name="company" id="company" value="test" />

                              {/if}

Share this post


Link to post
Share on other sites

Jeg får stadig fejl, men er det fordi denne også skal være "hidden":

 

<div class="form-group">
<label for="company_invoice">{l s='Company'}</label>
<input type="text" class="text form-control" id="company_invoice" name="company_invoice" value="" />
</div>

Share this post


Link to post
Share on other sites

Jeg får denne fejl:

 

There is 1 error

  1. company is required.

 

Og jeg har jeg slettet det her:

<div class="form-group">

<label for="company">{l s='Company'}</label>
<input type="text" class="form-control" id="company" name="company" value="{if isset($smarty.post.company)}{$smarty.post.company}{/if}" />
</div>
 
 
OG sat det her ind i stedet: <input type="hidden" name="company" id="company" value="-" />

Share this post


Link to post
Share on other sites

Tror vi løser det på en bedre måde. Jeg fandt dette:

 

 

you can define field as required in classes/Address.php file

there is an object definition:

public static $definition = array(
        'table' => 'address',
        'primary' => 'id_address',
        'fields' => array(
            'id_customer' =>         array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false),
            'id_manufacturer' =>     array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false),
            'id_supplier' =>         array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false),
            'id_warehouse' =>         array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false),
            'id_country' =>         array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
            'id_state' =>             array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId'),
            'alias' =>                 array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
            'company' =>             array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64),
            'lastname' =>             array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
            'firstname' =>             array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
            'vat_number' =>             array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
            'address1' =>             array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'required' => true, 'size' => 128),
            'address2' =>             array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'size' => 128),
            'postcode' =>             array('type' => self::TYPE_STRING, 'validate' => 'isPostCode', 'size' => 12),
            'city' =>                 array('type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => true, 'size' => 64),
            'other' =>                 array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 300),
            'phone' =>                 array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32),
            'phone_mobile' =>         array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32),
            'dni' =>                 array('type' => self::TYPE_STRING, 'validate' => 'isDniLite', 'size' => 16),
            'deleted' =>             array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
            'date_add' =>             array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false),
            'date_upd' =>             array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false),
        ),
    );

required fields have got required=> true param, just remove it

 

Prøv lige at følge det på de felter du vil af med.

Share this post


Link to post
Share on other sites

I den fil skal du ændre:

 

'lastname' =>             array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),

 

til

 

'lastname' =>             array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32),

Share this post


Link to post
Share on other sites

men company har ikke required? 


public static $definition = array(
'table' => 'address',
'primary' => 'id_address',
'fields' => array(
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false),
'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false),
'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false),
'id_warehouse' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false),
'id_country' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_state' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId'),
'alias' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
'company' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64),
'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
'vat_number' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
'address1' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'required' => true, 'size' => 128),
'address2' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'size' => 128),
'postcode' => array('type' => self::TYPE_STRING, 'validate' => 'isPostCode', 'size' => 12),
'city' => array('type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => true, 'size' => 64),
'other' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 300),
'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32),
'phone_mobile' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32),
'dni' => array('type' => self::TYPE_STRING, 'validate' => 'isDniLite', 'size' => 16),
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false),

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More