logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Christianto



Written in response to gravityform use dropdown choice as variable in gform_pre_render:

Josh,

the questions is closed so I couldn't post a comment.
My question is, can I keep the value on the the dealer drowndown if the there is an error on the form?

The dealer country stays on the selected item which is great, how ever the dealer down resets back to 'default'.

Because 2nd <select> options element fetched using ajax, if you need to remember the value of this element, we can save it inside cookie.

please check this:
https://gist.github.com/4672709

Also, I dont suppose you know a way or making...
$items[] = array( "text" => __('Select country...','mission-theme'), "value" => "default" ); 

...a non selectable item. So if my field is set to Field Required, how can I stop this from being a choice?

for validation on gform, empty value will return false to validate, on function get_dealer_name_fn(), please try to empty the "value" inside items array:
$items[] = array( "text" => __('Select dealer...','mission-theme'), "value" => '' );

and for javascript side, change:
if(country != 'default')

to
if(country != '') 

or
if(country)


Hope this help


Updated: 01/30/13 11:50am


Upvote / Downvote

3 groups of people are allowed to vote for discourse:

All votes are public.

You are not allowed to vote: