Jump to content

Hjælp til at undgå error i oprettelse


mariesnejstrup

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

Link to comment
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}" />
Link to comment
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> 

Link to comment
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> 
Link to comment
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="-" />
Link to comment
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.

Link to comment
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),

Link to comment
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),
Link to comment
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
×
×
  • Create New...