Page 1 of 1

Adding custom fields to Admin object

Posted: Sun Apr 30, 2017 8:00 am
by alex4orly
I want to add a new field - A combo box with a few options
I tried using the : Collection->Option with the following code, this doesn't work...

<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>

Re: Adding custom fields to Admin object

Posted: Sun Apr 30, 2017 9:15 am
by Pablo
What exactly does not work?
What are your exact settings?
What is the result?

Re: Adding custom fields to Admin object

Posted: Sun Apr 30, 2017 9:31 pm
by alex4orly
Please have a look at : http://www.nmaa-rc.org.au/admin3.php

It comes up as an empty frame, I tried changing the code to the following

<select name="extra3" size="1" id="Combobox1">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>

Re: Adding custom fields to Admin object

Posted: Mon May 01, 2017 6:39 am
by Pablo
Do you mean that the entire page does not work only because you have added this code?
In that case there must be an error in the PHP code somewhere.

I think it is helpful is you enabled PHP error reporting on the server so you can see where it stops working.

Re: Adding custom fields to Admin object

Posted: Mon May 01, 2017 8:23 am
by alex4orly
There is a problem on that website, I am waiting for the host platform to get back to me.
In the meantime, I repeated my setup here : http://www.beleuramyhome.org.au/page4.php

I added one extra item into the collection with the following code:

<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>

When I run this page I get an error which I don't understand
Hope you can help me

Re: Adding custom fields to Admin object

Posted: Mon May 01, 2017 11:15 am
by Pablo
I'm sorry I cannot find the specified page.
What do I need to do to see the the problem?

Re: Adding custom fields to Admin object

Posted: Mon May 01, 2017 11:42 am
by alex4orly
Please go to : http://www.beleuramyhome.org.au/
Then type at the continuation : page4.php
And you will get it

Thanks

Re: Adding custom fields to Admin object

Posted: Mon May 01, 2017 11:47 am
by alex4orly
The error is :
Parse error: syntax error, unexpected T_STRING in /home/bebe2839/public_html/loginadmin.php on line 497

In the script on that line there is :

case "<select name="cars">":

$selected[0] = "selected";
break;

case " <option value="volvo">Volvo</option>":

$selected[1] = "selected";
break;

case " <option value="saab">Saab</option>":

$selected[2] = "selected";
break;

case " <option value="fiat">Fiat</option>":

$selected[3] = "selected";
break;

case " <option value="audi">Audi</option>":

$selected[4] = "selected";
break;

case "</select>":

$selected[5] = "selected";
break;

case "":

$selected[6] = "selected";
break;

Re: Adding custom fields to Admin object

Posted: Mon May 01, 2017 11:52 am
by Pablo
The code is invalid. This is not valid PHP code. Was this code generated by Web Builder?
If yes, then please share your project so I can see your settings.

Re: Adding custom fields to Admin object

Posted: Mon May 01, 2017 3:04 pm
by Pablo
Thanks for sending the project. Options should be added like this:
Volvo
Saab
Fiat
Audi
not with HTML code.

Re: Adding custom fields to Admin object

Posted: Mon May 01, 2017 8:33 pm
by alex4orly
Thanks, that works just fine
I wonder, how does WWB know I want a combobox....
Cheers

Re: Adding custom fields to Admin object

Posted: Mon May 01, 2017 8:36 pm
by Pablo
Because if you select 'options' this will automatically create a combobox.

From the help:
New fields can be of type' text', 'option' or 'checkbox'. A text field adds a standard editbox ,while the option fields adds a combobox to give the user multiple choices.