I wanted to implement a booking form where we have multiple names defined per ticket / booking, where the second name is optional, but could not so far accomplish this.
I exported the form and added an entry thus:
{
"label":"Partner / Guest Name",
"name":"SpouseName",
"placeholder":"",
"required":false,
"parent":9999,
"label_fname":"First Name",
"label_lname":"Last Name",
"lname_required":0,
"type":"name",
"field_name":"spousename",
"position":3,
"class":"serena-ontario-text-input",
"id":"spousename"
},
but the code is somehow still treating the above as mandatory. I looked into the code and it seems to be “hardcoded” to treat the name as mandatory. I tried modifying the code to add a new type called “spousename” (replacing the above “type”: “name” with “type” : “spousename”) but I ran into difficulties trying to do so.
If there is an easy way to accomplish the above I would love to hear it!
Thanks
Colin
Colin Gajraj
Hi Colin,
I can’t replicate this unfortunately. On the booking form customer can you confirm that the ‘require second name’ checkbox is unchecked.
Are you testing this as a logged-in user? And does that user have a surname entered in their profile? There is a known bug where if a logged-in user doesn’t have a surname, the booking will be rejected (if a surname is required on the original name field) but the name field itself is not displayed – because its removed for logged-in users. I’m asking because its possible – if you are logged -in – that the booking is being rejected because of invalid values for the original name field, but that you’re attributing it to your added field as the original name field does not appear.
Stephen Harris
Hi Stephen
Yes I confirmed that the ‘require second name’ checkbox is unchecked.
I am not testing this as a logged-in user.
If you cannot reproduce this then maybe it’s due to some overridden code that I have? I can try with a fresh install of your plugin to see whether the problem still exists.
So basically you are able to export the form and add my code above to the JSON, re-import and the second name does NOT show up as mandatory? I am just double checking.
Thanks
Colin
Colin Gajraj
Hi Colin,
That’s correct. The only change I otherwise had to make was to update the event to use the newly imported booking form.
Stephen Harris