i am linking to a form from a number of locations. i am currently passing a querystring in the link to the form page and want to select an option in a radiobuttonlist which corresponds to that value.
it works with the value direct into the field but i cannot seem to pick it up from the querystring
I have entered [@query] in the default value on a Contour form field, but when the form loads it actually contains [@query] instead of the value passed in on the query string - e.g. ?query=test
I have just done some further testing and the value does come when using a key that is longer than 1 char.
I was using [@p] & [%b] with no luck - hence the question... but have made [@pr] now with result as expected.
Sorry for your time, though it may be a quirk? Unless querystring 'p' is somehow reserved, etc - haven't tried with the cookie yet but assume making at least 2 chars will resolve as well.
The prevalues is writing out node name and not id. The form is being written out using razor macro and i suspect thats where the issue is. I am just looking at the contourform.cshtml and there is nothing in there about querystring test and pre fill. Time for some hacking lol!!
It was that the razor views was not checking for querystring parameter. So I created new view for this form and then added new razor for dropdown field type just for this form and it all works. I love it full control over the markup wow just wow!!!
Set value of radiobuttonlist from querystring
hi i am using umbraco 4.5.2 with contour 1.1.1
i am linking to a form from a number of locations. i am currently passing a querystring in the link to the form page and want to select an option in a radiobuttonlist which corresponds to that value.
it works with the value direct into the field but i cannot seem to pick it up from the querystring
is it possible?
any suggestions?
Comment author was deleted
it should work if you have the correct syntax, in the default value input set it to [@requestValueKey]
Hey Tim
I have entered [@query] in the default value on a Contour form field, but when the form loads it actually contains [@query] instead of the value passed in on the query string - e.g. ?query=test
Am I doing it correctly???
I'm using v4.5.2 on .Net 4.0
Comment author was deleted
@Kim, what version of Contour are you running ?
Hi Tim,
Thanks for the reply. I updated Contour and now it works as you specified :)
Best regards
Kim :)
Works for me too, thanks tim
Hi Tim
This appears to be an issue again in 4.11.1 using contour 3.0.4 with a razor form.
[#pageID] works, but [@requestValueKey] and [%sessionKey] don't.
Thoughts?
Josh
Comment author was deleted
@Josh will check it out
Comment author was deleted
@Josh, just tested and it works like expected, any more details on a setup that doesn't work?
@Tim, Thanks!
I have just done some further testing and the value does come when using a key that is longer than 1 char.
I was using [@p] & [%b] with no luck - hence the question... but have made [@pr] now with result as expected.
Sorry for your time, though it may be a quirk? Unless querystring 'p' is somehow reserved, etc - haven't tried with the cookie yet but assume making at least 2 chars will resolve as well.
Thanks
J
Comment author was deleted
Yeah sounds like a quirk, thanks for the extra details :)
Tim,
I have a drop down list which is populated from prevalues and the prevalues source is umbraco nodes. I have a link to the form page looks like:
/contact-us/?location=Manchester
In contour for my office location field I have in default value [@location] I am using umbraco 4117 and latest version of contour downloaded from our.
Any ideas?
Regards
Ismail
Hey Ismail
Have you tried passing the nodeId rather than nodeName in the query string?
Just from memory I think using the umbraco nodes prevalue source stores the id- might be wrong but could be a quick fix...
Cheers
Josh
Josh,
The prevalues is writing out node name and not id. The form is being written out using razor macro and i suspect thats where the issue is. I am just looking at the contourform.cshtml and there is nothing in there about querystring test and pre fill. Time for some hacking lol!!
Regards
Ismail
Check with Tim as this should work OOTB, but yeah a quick razor or jQuery hack would be pretty easy! Get stuck in I say ;)
Josh sorted.
It was that the razor views was not checking for querystring parameter. So I created new view for this form and then added new razor for dropdown field type just for this form and it all works. I love it full control over the markup wow just wow!!!
Isn't it sweet- loving markup control and the codefirst production!
Can you log the issue: http://issues.umbraco.org/issues/CON
So Tim can make sure to review/roll this into a release, etc.
Cheers
Josh
is working on a reply...