
03-29-2010, 05:11 PM
|
|
|
Join Date: Oct 2007
Location: UK
Posts: 2,802
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally Posted by Bobbo
BananaLive,
First, thanks again for this mod. It's very flexible and provides value in many different scenarios. Your efforts are greatly appreciated!
I have a question thats more of a programming question. Not a mod bug or anything. I'm trying to figure out how I could make a custom question, which happens to be a select option drop down menu, retain it's value when performing a preview on a form.
So for example, I have a question that queries a sql database and builds a drop down list of data with the first choice selected 'New RQST' as the default. You make your choice, let's say it's 'RQST 109'. When I click preview, my preview looks great. However on the original form listed below, where you can make edits, the custom field has defaulted to 'New RQST'.
Does anyone know of some sort of technique that I could use to detect we're in preview to retain the selection?
Many Thanks.
Bobbo
|
Add to the bottom of your php code for that question:
PHP Code:
$search = ">".$formbit['value']."<";
$replace = " selected=\"selected\">".$formbit['value']."<";
$answer = str_replace($search, $replace, $answer);
|