Jump to content

Custom Field value not showing as selected


Recommended Posts

I am using a client custom field for a how did you find us dropdown. It is working fine and the drop -down is showing in my site using API. But when I edit the field and update, then in client profile in WHMCS end, this value is not shown as selected in the dropdown. It is always showing the first value. But if I change the value and save from WHMCS, it is showing as selected. I am using the following function for update using API.

 

       $postfields["action"] = "updateclient";
       $postfields["clientid"] = $details['userid'];
       $postfields["firstname"] = $details['firstname'];
       $postfields["lastname"] = $details['lastname'];
       $postfields["email"] = $details['email'];
       $postfields["companyname"] = $details['companyname'];
       $postfields["address1"] = $details['address1'];
       $postfields["address2"] = $details['address2'];
       $postfields["city"] = $details['city'];
       $postfields["state"] = $details['state'];
       $postfields["postcode"] = $details['postcode'];
       $postfields["phonenumber"] = $details['phonenumber'];
       $postfields["country"] = $details['country'];

       if ($details['customfields']) {
           if (is_array($details['customfields']))
               $postfields["customfields"] = base64_encode(serialize($details['customfields']));
       }
       else
           $postfields["customfields"] = '';

       $results = $this->initcurl($postfields);

 

This CURL request is handled in another function and the values are successfully changed tblcustomfieldsvalues. I can see the new value in this table and also if I use getclientsdetails API call, the values are showing. But this value is not showing as selected in the custom field dropdown in WHMCS.

Link to comment
Share on other sites

In your $details['customfields'] array, make sure you are assigning the fieldid from the tblcustomfields table properly also make sure the value your are assigning is exactly as show in the list of options you entered into WHMCS with no extra spaces.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated