Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I have a Combo Box on my webform. I am trying to code it so that the choice entered is retained, if correct, when the form returns other errors. Internet searches suggest I need to do this in the Value of the Combo Box from the Properties Pane in RocketCake. This I understand, however the code needs to be inserted between the <option> tags. The searches tell me the code is this (or other versions of this) : <?php echo $Month =='December'?'selected':' ';?> (where in my form, December is one of the choices for the Combo Box called 'Month', that can be chosen) putting this in the Value (Properties pane) results in this: <option value="<?php echo $Month =='December'?'selected':' ';?">December</option> however, the code actually needs to be after the "" of value= and before the >December</option>. in other words, I want it to look like this: <option value="December" <?php if ($Month == "December") { echo " selected"; }?>>December</option> How can I get code to be inserted between <option value="..." and >....</option>? Or is there another way to retain the drop-down choice selected when, if correct, stays there when form returns with other errors. |
||||
|
Sorry, used two different versions of the code: So to be more clear (hopefully ) If I am trying to use: <?php echo $Month =='December'?'selected':' ';?> . . . I would want it to look like this: <option value="December" <?php echo $Month =='December'?'selected':' ';?>>December</option> |
||||
|
Uh, I'm not sure you can do this in RocketCake by using the ComboBox element. Unfortunately, you probably need to use a Code element and paste the full code for the full combobox in there. But if anyone else has an idea, maybe I just didn't get it right. |
||||
|
Niko: Thank you. This worked. Next problem.... is redirecting the form. I will post a new thread so it can be searched if necessary. |
|