jquery dialog field only works before user Input -
before start describing problem: thank taking time read this!
i trying code basic event-calendar. user should able create events , update event-parameters. if existing event clicked, jquery dialog ment open , show editable textfield each event-parameter. far works fine. problem that, of parameters manualy changed , saved, textfields not accept further modification of there value. should normaly set parameter-value of clicked event before dialog opens.
i tried find answer problem via stackoverflows serch function , google. tried lot of things found using dialog create parameter , setting function assign event parameters input fields or create form code dynamicaly each time before dialog opens. nothing seems help.
i guess missing essential point problem.
i using "fullcalendar" jquery-plugin , codesnippets of jquery-ui dialog-form template. (fullcalendar: http://arshaw.com/fullcalendar/ )
(jquery dialog-form: http://jqueryui.com/dialog/#modal-form )
thank time , effort took read this.
here parts of code:
---initialisation of fullcalendar---- eventclick: function (event, element) { var id = $( "#id" ), title = $( "#title" ), allfields = $( [] ).add( id ).add( title ); $( "#dialog-form" ).dialog ({ autoopen: false, height: 320, width: 350, modal: true, close: function() { allfields.attr( "value", "" ); }, buttons: { "update event": function() { var bvalid = true; // to-do: entry check logic if ( bvalid ) { event.title=$("#title").val(); $('#calendar').fullcalendar('updateevent', event); $( ).dialog( "close" ); } }, cancel: function() { $(this).dialog( "close" ); } } }); $("#id").attr("value",event._id); $("#title").attr("value",event.title); $( "#dialog-form" ).dialog( "open" ); } }); }); ----some css---- </head> <body > <div id='calendar'></div> <div class="lightness" id="dialog-form" title="parameter"> <p class="validatetips">all form fields required.</p> <form> <fieldset id="beforesubmit"> <label for="id">id</label> <input type="text" name="id" id="id" /> <label for="title">title</label> <input type="text" name="title" id="title" value="" /> </fieldset> </form> </div> </body> </html>
well after quite while of agony , "banging-my-head-through-the-wall" found solution. seems
.attr("vaule",something)
is not method of choice here. works fine define value befor kind of user input fails update value thereafter. should have used is:
.val(something)
now why method may write after user input, while .attr may not: have no idea.
thanks has read question! hope here might able explain why happens.
Comments
Post a Comment