- Posts: 62
- Thank you received: 0
Unhide custom field after updating in view
- Do you have a serial number? Yes/No
- Serial Number
This is all working fine but I have recently edited the custom_fields view. This now checks for and populates these fields if an existing serial number is available based on the logged in user. This is all working but for some reason the Serial Number field is still hidden unless I click on the Yes toggle, even though it is already active on yes. Also when you click yes the serial number is populated so the values are being updated bu the display is not until I click on Yes.
Any ideas on what I might be doing wrong? I would like to display the serial number field if I update the fields in the view.
Please Log in or Create an account to join the conversation.
Are you using, radio button ? Could you give us a link to that page, and a test account ?
Please Log in or Create an account to join the conversation.
www.calxa.com.au/index.php?Itemid=69&opt...=product&layout=show
Add any product to the cart then login as:
Username: hika
Password: hika
The second step in the checkout is titled Serial Number. You will note there are two front end visible fields labeled;
Do you have a serial number?
Serial Number
The 'Serial Number' fields is configured to display only when 'Do you have a serial number?' = 'Yes'
Using the hika user these fields will be populated with Yes and ThisIsASerialNumber, however the second field is not shown until you click on Yes.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Is there something wrong with the syntax for serialNumber.value to return undefined?
Please Log in or Create an account to join the conversation.
This is causing a problem though because I can't proceed to the next step. A message is displayed saying:
Please fill the Do you have an existing Calxa serial number? field.
I don't understand why this is when a default value of "no" should be set. If I output the value of $this->order->order_existing_serial it says "no", yet the error message suggests it is not populated.
If you would like to reproduce this to see it in action you will need to add two different but not including Monthly Subscription products to the cart. You should then get the scenario where the custom order fields are not displayed.
Please Log in or Create an account to join the conversation.
The js variable serialNumber doesn't have the input field value in it.
It should actually be:
If the field is required, you can't remove its HTML. The system is done so that even if the user try to cheat by removing the HTML on the page, it won't allow the user to continue. Xavier mthod of hidding the HTML instead in CSS will allow you to reach the same function without the issue with the require check since the fields will actually still be processed.
Please Log in or Create an account to join the conversation.
As a test I also removed the option to limit the display of this field. Then is I changed the 'block' to 'none' and I could see the changes reflected, so we no the script is now being correctly called. Having said this the field is still not shown when you first display the custom fields (Serial Number) step. My thoughts are that this script is being called too early and then the limit display option comes in after this one and hides it again. What script handles the conditional display of that field normally?
Please Log in or Create an account to join the conversation.
var serialNumberDiv = document.getElementById('hikashop_order_order_serial_number');
var serialNumber = document.getElementById('order_existing_serial_yes');
if(serialNumber.checked) serialNumberDiv.style.display = 'block';
Please Log in or Create an account to join the conversation.
Do you need some more information?
Please Log in or Create an account to join the conversation.
window.addEvent('domready', function(){
var serialNumberDiv = document.getElementById('hikashop_order_order_serial_number');
var serialNumber = document.getElementById('order_existing_serial_yes');
if(serialNumber.checked) serialNumberDiv.style.display = 'block';
});
Please Log in or Create an account to join the conversation.
However as we got tied up in this problem we have left another question problem alone. I let it go because I figured it would be easier to focus on one at a time.
Anyway here is the details of my other problem. I have now also made customisations to the "checkout\fields" view. The purpose of this change is to not display the "custom_fields" at all if they are not required. Instead I am just displaying some text explaining that new serial numbers must be issued.
This is causing a problem though because I can't proceed to the next step. A message is displayed saying:
Please fill the Do you have an existing Calxa serial number? field.
I don't understand why this is when a default value of "no" should be set. If I output the value of $this->order->order_existing_serial it says "no", yet the error message suggests it is not populated.
If you would like to reproduce this to see it in action you will need to add two different but not including Monthly Subscription products to the cart. You should then get the scenario where the custom order fields are not displayed.
Please Log in or Create an account to join the conversation.
Please give a link to the two product pages to add to the cart to reproduce the problem and explain the modification that you did.
Please Log in or Create an account to join the conversation.
On this page add the Calxa Premier 1 Year Subscription and the Calxa Premier 3 Year Subscription. Now login and proceed to the Serial Number step. If you click next on this step it returns the message saying Please fill the Do you have an existing Calxa serial number? field.
Here is the custom view checkout / fields.php
Please Log in or Create an account to join the conversation.
Your code is not correct.
You should add hidden input fields to replace the custom fields that you don't display in your else block of code.
Please Log in or Create an account to join the conversation.
As described in previous posts I have my fields step as a separate step in the checkout (login_address_shipping_coupon,fields,payment_terms_confirm_cart_status,end). My problem is that you need to click Next twice to proceed to the next step. I assume this has always been an issue since I made the above customisations but I have only just noticed it. Perhaps it is only an issue because the Fields step is on it's own but I do require this to be a separate step.
If you do click past this step to the payment step and then go back you no longer require to click next twice, so I assume the fields are not being marked as OK early enough to proceed the first time.
Can you please assist me with this as I would like the user to be able to fill out the fields and then proceed without having to click next twice?
Please Log in or Create an account to join the conversation.
I have no idea. I remember such bug in previous versions of HikaShop but we don't have the problem with the latest version on our end and I don't see why the modifications of this thread would change that.
Did you try on a copy of your website with the latest version of HikaShop ? If it still doesn't work, does it work if you remove your changes ?
Please Log in or Create an account to join the conversation.