mariesnejstrup Posted November 6, 2014 Share Posted November 6, 2014 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 lastname is required. id_country is required. company is required. postcode is required. city is required. Country cannot be loaded with address->id_country Country is invalid Hvordan undgår jeg disse errors? Og hvad ville være det optimale at gøre? Link to comment Share on other sites More sharing options...
nsordk Posted November 6, 2014 Share Posted November 6, 2014 Nemmeste løsning er at lave de felter om til hidden felter. <input type="hidden" name="SÆT NAVN IND" id="SÆT ID IND" value="SÆT VÆRDI IND" /> Link to comment Share on other sites More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 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 More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 Så længe du sætter dit hidden input ind med samme name og id så kan du udkommentere de tilsvarende felter. Link to comment Share on other sites More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 Har jeg gjort det korrekt i ovenstående? Synes nemlig stadig jeg får advarsels fejl.. Kan du evt give mig et eksempel med den kode jeg har sat ind? Jeg er ikke så stærk i kodning :/ Link to comment Share on other sites More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 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. Link to comment Share on other sites More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 Får disse fejl stadig: There are 2 errors company is required. 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 More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 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 More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 Ja det er korrekt. Så det eneste der skal stå der er: <input type="hidden" name="lastname" id="lastname" value="test" /> Link to comment Share on other sites More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 Korrekt, får du så stadig fejlen? Link to comment Share on other sites More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 Nej, det virker nu! Tusind tak for hjælpen! Du har reddet min dag! Link to comment Share on other sites More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 Velbekommen, fedt at du fik det løst Link to comment Share on other sites More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 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} Link to comment Share on other sites More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 præcis Du kan nok udskifte "Test" med noget andet hvis det er, en streg eller noget andet. Link to comment Share on other sites More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 Således: <input type="hidden" name="company" id="company" value="-" /> Link to comment Share on other sites More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 Netop Link to comment Share on other sites More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 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> Link to comment Share on other sites More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 Du skal lave hidden felter for alle de felter du ønsker at fjerne. Link to comment Share on other sites More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 Jeg får denne fejl: There is 1 error 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 More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 Så er det nok den streg vi satte ind istedet for "Test", se lige om det fjerner fejlen at sætte test ind igen. Link to comment Share on other sites More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 Jeg får stadig error :/ - Men company_invoice, har ikke noget med denne at gøre vel? Link to comment Share on other sites More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 error i company eller company_invoice? Link to comment Share on other sites More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 There is 1 error company is required. Link to comment Share on other sites More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 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 More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 Så istedet for "hidden" skal jeg placere denne: array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64), Link to comment Share on other sites More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 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 More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 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 More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 Jeg bliver nok nødt til at se siden hvis jeg skal fejlsøge på den. Link to comment Share on other sites More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 Ja, hvilken side vil du se? Adress.php eller authentication? Link to comment Share on other sites More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 Jeg mener se siden i en browser Link to comment Share on other sites More sharing options...
mariesnejstrup Posted November 11, 2014 Author Share Posted November 11, 2014 Ja, har du en mail jeg kan skrive linket til? Link to comment Share on other sites More sharing options...
nsordk Posted November 11, 2014 Share Posted November 11, 2014 Smid den i en privatbesked. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now