views:

40

answers:

3

I think the below problem is something to do with escaping strings, but i'm hoping someone will confirm that.

i need to append event.id to the submit value like so: /Events/Edit/ + event.id. There is definitely content in the event.id property as it displays correctly the second time i use it.

$('.ui-dialog div.ui-dialog-buttonpane')
    .append('<button type="submit" value="/Events/Edit/"'  
            + event.id 
            + ' class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" ><span class="ui-button-text">' 
            + event.id + '</span></button>');
+5  A: 

i think your problem may be that you have value="/Events/Edit/"'+ event.id You probably meant value="/Events/Edit/'+ event.id +'" [the rest of your snippet]

dave
+1  A: 

Move the " forward to after event.id:

$('.ui-dialog div.ui-dialog-buttonpane').append('<button type="submit" value="/Events/Edit/'  + event.id + '" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" ><span class="ui-button-text">' + event.id + '</span></button>');
Matthew Wilson
Of course. What a chump! :)
Doozer1979
+2  A: 

You just need to move the double quote to after you append the event id (broke things up a little more to make it more readable):

$('.ui-dialog div.ui-dialog-buttonpane')
    .append('<button type="submit" value="/Events/Edit/'
        + event.id 
        + '" class="ui-button ui-widget ui-state-default '
        + 'ui-corner-all ui-button-text-only" ><span class="ui-button-text">' 
        + event.id + '</span></button>');
Justin Niessner