Passing variable on form submit without using hidden inputs

I’ve tried this a million ways, So i figured i would just break down and ask

typically, my setup is a handler with different events for edit view, and save for form submit

function edit(event, rc, prc) {

rc.query=getmodel(“somemodel”).getlist(rc.unique);
}

function save(rc, prc){
event.norender();
getPlugin(“MessageBox”).info("#rc.allocation# Saved");
setNextEvent(event=“myhandler.edit”, url=“edit?unique=#rc.allocation#”);
}

on the edit view, url like this myhandler/edit?unique=99 , i have a form

Now unless i set a hidden input in my form like this

I always get an Error “Element UNIQUE is undefined in RC”

I know there has got to be a way to be able to pass a parameter on form submit without it being defined as an input, i just cannot find a single example on how todo so

There are two ways you can pass a value to the server that will become part of the rc. The first method is to include it as a form field. The second method is to include it in the URL query string of the form’s action page.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I have attempted this unfortunately, my version was a little different, I tried changing

to this

and still received the undefined in RC error

Are you using SES URLs? If not, you might need to use an &. Also, note that you’re mixing single and double quotes in the code you pasted in the E-mail below.

The buildLink() method actually has a queryString parameter you can use too:

#buildLink(linkTo=‘myhandler.save’, queryString=‘unique=’ & rc.unique)#

View source on your edit page and look at what the rendered action attribute’s value is in your form tag.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com